-
Notifications
You must be signed in to change notification settings - Fork 82
table a11y fix #4042
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: next
Are you sure you want to change the base?
table a11y fix #4042
Conversation
✅ Deploy Preview for carbon-addons-iot-react ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| .#{$prefix}--table-sort { | ||
| padding-left: 0; | ||
| padding-right: 0; | ||
| // padding-left: 0; |
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.
This can be removed if not needed
| padding-left: 0; | ||
| padding-right: 0; | ||
| // padding-left: 0; | ||
| padding-inline-start: 1rem; |
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.
| padding-inline-start: 1rem; | |
| padding-inline-start: $spacing-05; |
| .#{$prefix}--table-header-label, | ||
| .#{$prefix}--tooltip--definition { | ||
| padding-left: $spacing-05; | ||
| padding-left: 0; |
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.
Prefer using padding-inline-start instead
|
|
||
| return ( | ||
| // eslint-disable-next-line jsx-a11y/click-events-have-key-events | ||
| // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions |
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.
Isn't this clickable? Why all the rules to disable interaction?
Also, why isn't it a button?
| // .#{$prefix}--definition-term > span:last-child { | ||
| // padding-inline-start: 0rem; | ||
|
|
||
| // } |
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.
Please remove this if not needed
| TriggerElement = () => React.createElement(as, triggerProps, children); | ||
| } else { | ||
| // Option 3: Custom React component | ||
| TriggerElement = () => React.createElement(as, triggerProps, children); |
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.
Same as above
| } | ||
|
|
||
| // Common trigger props | ||
| const triggerProps = { |
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.
Ideally, this should be moved to outside of the component. if that's not possible, it should be a memo to avoid unnecessary re-renders
|
|
||
| // Add onClick for anchor tags | ||
| if (as === 'a' || (typeof as === 'string' && as.toLowerCase() === 'a')) { | ||
| triggerProps.onClick = (event) => { |
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.
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 think this event is not clicking here it binding click event along with other props.
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.
This 3 prop will not came from props its dynamic adding if as == "a" passed and user can not passing this event from props. its binding run time with a.
| }; | ||
| // Add href for anchor tags if not provided | ||
| if (!rest.href) { | ||
| triggerProps.href = '#'; |
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.
Same as above
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.
This 3 prop will not came from props its dynamic adding if as == "a" passed and user can not passing this event from props. its binding run time with a.
|
|
||
| // Add type for button | ||
| if (as === 'button' || (typeof as === 'string' && as.toLowerCase() === 'button')) { | ||
| triggerProps.type = rest.type || 'button'; |
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.
Same as above
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.
This 3 prop will not came from props its dynamic adding if as == "a" passed and user can not passing this event from props. its binding run time with a.

Closes #
Summary
This PR addresses multiple accessibility issues in the Table component, focusing on keyboard navigation, ARIA attributes, and screen reader support. The changes include refactoring the DefinitionTooltip component to support flexible trigger elements, improving column resize keyboard controls, and enhancing TableToolbar batch actions accessibility.
Change List
New utility module for keyboard event handling
Exported keys object with common key constants
match() function for checking keyboard events
Change List (commits, features, bugs, etc)
Acceptance Test (how to verify the PR)
Regression Test (how to make sure this PR doesn't break old functionality)
Things to look for during review
iotorbxclass prefix is using the prefix variabledata-testidattribute. New test ids should have test written to ensure they are not changed or removed.