Skip to content

Conversation

@anishkumar-bhut
Copy link
Collaborator

@anishkumar-bhut anishkumar-bhut commented Nov 19, 2025

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

  1. New DefinitionTooltip Component (packages/react/src/components/Tooltip/DefinitionTooltip.jsx)
  2. Column Resize Keyboard Support (packages/react/src/components/Table/TableHead/ColumnResize.jsx)
  3. TableCellRenderer Updates (packages/react/src/components/Table/TableCellRenderer/TableCellRenderer.jsx)
  4. TableToolbar Accessibility (packages/react/src/components/Table/TableToolbar/TableToolbar.jsx)
  5. Styling Updates
  6. Keyboard Utilities (packages/react/src/internal/keyboard.js)
    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)

  • items_here

Acceptance Test (how to verify the PR)

  • tests here

Regression Test (how to make sure this PR doesn't break old functionality)

  • tests here

Things to look for during review

  • Make sure all references to iot or bx class prefix is using the prefix variable
  • (React) All major areas have a data-testid attribute. New test ids should have test written to ensure they are not changed or removed.
  • UI should be checked in RTL mode to ensure the proper handling of layout and text.
  • All strings should be translatable.
  • The code should pass a11y scans (The storybook a11y knob should show no violations). New components should have a11y test written.
  • Unit test should be written and should have a coverage of 90% or higher in all areas.
  • All components should be passing visual regression test. For new styles or components either a visual regression test should be written for all permutations or the base image updated.
  • Changes or new components should either write new or update existing documentation.
  • PR should link and close out an existing issue

@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for carbon-addons-iot-react ready!

Name Link
🔨 Latest commit ebfecdb
🔍 Latest deploy log https://app.netlify.com/projects/carbon-addons-iot-react/deploys/6940fc1ca289880008d26d98
😎 Deploy Preview https://deploy-preview-4042--carbon-addons-iot-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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;
Copy link
Collaborator

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding-inline-start: 1rem;
padding-inline-start: $spacing-05;

.#{$prefix}--table-header-label,
.#{$prefix}--tooltip--definition {
padding-left: $spacing-05;
padding-left: 0;
Copy link
Collaborator

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
Copy link
Collaborator

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?

Comment on lines 24 to 27
// .#{$prefix}--definition-term > span:last-child {
// padding-inline-start: 0rem;

// }
Copy link
Collaborator

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);
Copy link
Collaborator

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 = {
Copy link
Collaborator

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) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onClick is not part of the expected props:
image

And there's no guard agains that. It should at least have an if to check if triggerProps.onClick exists, or an optional chaining

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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 = '#';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Collaborator Author

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';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants