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

fix(tabletoolbar): provide aria-label to CarbonTableToolbar #2860

Merged

Conversation

TheSharpieOne
Copy link

@TheSharpieOne TheSharpieOne commented Sep 20, 2021

Closes #2607

Summary

  • Allows TableToolbar to send aria-label to the underlying carbon-component.

Change List (commits, features, bugs, etc)

  • Add toolbarLabelAria to Table's i18n prop and forwards it to TableToolbar
  • TableToolbar now pull toolbarLabelAria out of i18n to pass to the underlying carbon-component

Acceptance Test (how to verify the PR)

  • snapshots

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

  • Table still Renders
  • TableToolbar still Renders

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 Sep 20, 2021

✔️ Deploy Preview for ai-apps-pal-angular ready!

🔨 Explore the source changes: c2b23d8

🔍 Inspect the deploy log: https://app.netlify.com/sites/ai-apps-pal-angular/deploys/6148cee614456e0008760d26

😎 Browse the preview: https://deploy-preview-2860--ai-apps-pal-angular.netlify.app

@netlify
Copy link

netlify bot commented Sep 20, 2021

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

🔨 Explore the source changes: c2b23d8

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-addons-iot-react/deploys/6148cee68ed47500075f37c3

😎 Browse the preview: https://deploy-preview-2860--carbon-addons-iot-react.netlify.app/

@netlify
Copy link

netlify bot commented Sep 20, 2021

✔️ Deploy Preview for ai-apps-pal-angular ready!

🔨 Explore the source changes: a43ffb5

🔍 Inspect the deploy log: https://app.netlify.com/sites/ai-apps-pal-angular/deploys/614c8998e9b4020008f0ae87

😎 Browse the preview: https://deploy-preview-2860--ai-apps-pal-angular.netlify.app

@netlify
Copy link

netlify bot commented Sep 20, 2021

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

🔨 Explore the source changes: a43ffb5

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-addons-iot-react/deploys/614cabb2f58ec300af3bc8e0

😎 Browse the preview: https://deploy-preview-2860--carbon-addons-iot-react.netlify.app

@@ -215,6 +216,7 @@ const TableToolbar = ({
// TODO: remove deprecated 'testID' in v3
data-testid={testID || testId}
className={classnames(`${iotPrefix}--table-toolbar`, className)}
aria-label={i18n.toolbarLabelAria || secondaryTitle ? `${secondaryTitle} Toolbar` : undefined}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @TheSharpieOne. Thanks for the PR! Since this could change aria-lables that are out in the wild I think we should just use undefined if toolbarlabelAria is not present.

Copy link
Author

Choose a reason for hiding this comment

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

Since aria-label could not be specified, the only value in the wild would be "data table toolbar", which is not a sane default. So it's not like the default truly is undefined. Default values should be useful so that users don't need to specify every prop every time (only needing to use props such as this for specials cases (e.g. i18n)).
Look at the changed snapshots and tell me this was not an improvement in a11y for the default case providing secondaryTitle.
I can mark this as a breaking change if you would like (carbon react doesn't seem to believe changes like this are considered breaking.)

Copy link
Contributor

Choose a reason for hiding this comment

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

It is an improvement, and I'll let David answer your question, but it is also a known problem for some of our clients that changes to default labels and roles etc are not considered breaking since they are sometimes used in automated tests that fail after the change.

Copy link
Author

Choose a reason for hiding this comment

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

rant
Yes, I believe it is a breaking change as well. It will definitely break snapshots (as seen by snapshots changing in the PR.) I just wasn't sure if this repo was more aligned with carbon react in it's definition of a breaking change since it's also within the carbon-design-system org.
We have had carbon react break us many times. Here are the most recent:
changes that prevent onChange callbacks from be called which break validation.
changes that add internal validation which affect component rendered output that cause visual changes.
/rant

I updated the commit message to indicate it is a breaking change. I included mitigation steps for users to preserve the current functionality to avoid changes.

@davidicus
Copy link
Collaborator

@TheSharpieOne I would be more than happy to include this in our next major release but that release date is still quite a ways off in the future. If this is something you will want to consume in the near term we should leave the defaults as undefined. If you are ok to wait for the next major release then we will want to open this against the v3 branch.

Previously, aria-label could not be specified on TableToolbar, letting Carbon's TableToolbar default it to 'data table toolbar'
This the label should be unqiue, but with multiple Tables with toolbars, it would only ever be 'data table toolbar'
This change allows aria-label be be specified via the i18n prop as toolbarLabelAria
@TheSharpieOne TheSharpieOne force-pushed the fix/table-toolbar-aria-label branch from d602170 to a43ffb5 Compare September 23, 2021 14:05
@kodiakhq kodiakhq bot merged commit 5bd56a1 into carbon-design-system:next Sep 23, 2021
@TheSharpieOne TheSharpieOne deleted the fix/table-toolbar-aria-label branch September 24, 2021 14:36
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.

[Table] TableToolbar not forwarding aria props
3 participants