Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue with tabbing when a radio is the last element of the modal #1045

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
11 changes: 3 additions & 8 deletions src/helpers/scopeTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ function getActiveElement(el = document) {
}

function areFromSameRadioGroup(a, b) {
return (
activeElement.type === "radio" &&
tail.type === "radio" &&
tail.name === activeElement.name
);
return a.type === "radio" && b.type === "radio" && a.name === b.name;
loganscharen marked this conversation as resolved.
Show resolved Hide resolved
}

export default function scopeTab(node, event) {
Expand All @@ -38,9 +34,8 @@ export default function scopeTab(node, event) {
}

if (
(tail === activeElement ||
areFromSameRadioGroup(activeElement, tail)) &&
!shiftKey
(tail === activeElement || areFromSameRadioGroup(activeElement, tail)) &&
!shiftKey
) {
target = head;
}
Expand Down