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(uishell): provide tabindex as a named prop #10900

Merged
merged 3 commits into from
Mar 14, 2022
Merged

Conversation

tay1orjones
Copy link
Member

@tay1orjones tay1orjones commented Mar 2, 2022

Surfaced in slack:

We have a situation where this component is usually hidden, and it’s an accessibility issue for tab navigation to traverse this element while it’s hidden. Therefore, we’d like to set its tabindex to -1 when it’s hidden.

This just moves the tabindex to be set before ...rest so it can be overridden This makes tabIndex a named and configurable prop.

Changelog

Changed

  • provide tabIndex as a prop for SwitcherItem and HeaderMenuItem

Testing / Reviewing

  • The component should still be navigable as it was before
  • Adding tabindex=-1 should prevent it from being in the tab order

@netlify
Copy link

netlify bot commented Mar 2, 2022

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: 223da3f

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/622bdbb2dc34250009872b54

😎 Browse the preview: https://deploy-preview-10900--carbon-react-next.netlify.app

@netlify
Copy link

netlify bot commented Mar 2, 2022

✔️ Deploy Preview for carbon-components-react ready!

🔨 Explore the source changes: 223da3f

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/622bdbb2f006a700091700a5

😎 Browse the preview: https://deploy-preview-10900--carbon-components-react.netlify.app

@netlify
Copy link

netlify bot commented Mar 2, 2022

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 223da3f

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/622bdbb262f8e500086ee4b1

😎 Browse the preview: https://deploy-preview-10900--carbon-elements.netlify.app

Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

For situations like this, would it be helpful if our convention was to make this an explicit/named prop?

This would allow us to safely override things that we need to control and allow a way to add in support for things over time. There are definitely things that should always be configurable (like tabindex) that we should straighten out but figured this could be a good heuristic going forward. Curious what you think

@JohnWColby
Copy link
Contributor

Is it possible to make a similar change here? We're running into the same issue trying to override the tabIndex for this component: https://github.com/carbon-design-system/carbon/blob/main/packages/react/src/components/UIShell/HeaderMenuItem.js#L37

@tay1orjones tay1orjones requested a review from a team as a code owner March 3, 2022 22:24
@tay1orjones tay1orjones changed the title fix(switcheritem): apply default tabindex before ...rest fix(uishell): provide tabindex as a named prop Mar 3, 2022
@tay1orjones
Copy link
Member Author

@joshblack Great point, I made them named props.

@ColbyJohnIBM I also made the update in HeaderMenuItem

@tay1orjones tay1orjones requested a review from joshblack March 3, 2022 22:27
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.

4 participants