-
Notifications
You must be signed in to change notification settings - Fork 81
Fixed tab index order for tab press #755
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,10 @@ const ActionItem = React.memo(({ | |
style={{ cursor: 'pointer' }} | ||
aria-checked={value === selected} | ||
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex | ||
tabIndex={value === selected ? '0' : '-1'} | ||
tabIndex={'0'} | ||
> | ||
<Icon src={Check} className={classNames('text-success mr-2', { invisible: value !== selected })} /> | ||
<Form.Radio id={id} className="sr-only sr-only-focusable" value={value} tabIndex="0"> | ||
<Form.Radio id={id} className="sr-only sr-only-focusable" value={value} tabIndex="-1"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not have a tabindex on a input type="radio". The radiogroup will take focus as a single tab stop, and the selection within the group may be changed via arrow keys (assuming all items have the same name attribute ). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to wrap a label with an icon over a sr-only input which will take focus (which is not the technique used by the Paragon radio buttons and checkboxes, btw), you can use css::focuswithin on the wrapping Label. to change the visible focus styling. |
||
{label} | ||
</Form.Radio> | ||
<span aria-hidden className="text-truncate"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,10 +42,10 @@ export const ActionItem = React.memo(({ | |
style={{ cursor: 'pointer' }} | ||
aria-checked={value === selected} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A label should never have an aria-checked attribute. The Form.Radio should have a regular checked value when appropriate. |
||
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex | ||
tabIndex={value === selected ? '0' : '-1'} | ||
tabIndex={'0'} | ||
> | ||
<Icon src={Check} className={classNames('text-success dropdown-icon-dimensions', { invisible: value !== selected })} /> | ||
<Form.Radio id={id} className="sr-only sr-only-focusable" value={value} tabIndex="0"> | ||
<Form.Radio id={id} className="sr-only sr-only-focusable" value={value} tabIndex="-1"> | ||
{label} | ||
</Form.Radio> | ||
<span aria-hidden className="text-truncate"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the git blame and it looks like this line was added for #483
Can you confirm the issue that PR was fixing is still fixed with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I’ve verified that the issue addressed in PR #483 is still resolved with the current change.
Thanks @brian-smith-tcril for pointing it out and for your thorough review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not have a tabindex on a Label, because it is a non-interactive role. This will throw a new error in automated testing.