-
Notifications
You must be signed in to change notification settings - Fork 139
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(Tearsheet): implement focus trapping within tearsheets #4129
fix(Tearsheet): implement focus trapping within tearsheets #4129
Conversation
Use 'keydown' event listener to implement focus trapping. Handle focus in code. One more issue resolve in the Narrow Tearsheet: - Update in Narrow Tearsheet storybook. - Add 'selectorPrimaryFocus' property to TearsheetNarrow component. - Assign tabIndex and id to the main content div inside TearsheetNarrow.
Logic change in 'keydown' event handler function.
introduce conditional tabIndex for RadioTile component in MultiStepWithIntro.js file to resolve focus issue in selected RadioTile component
✅ Deploy Preview for carbon-for-ibm-products ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Code looks fine and seems to be working.
@Ratheeshrajan @elycheea @lee-chase I have tried this
However, I am trying to improve my current solution to make it more efficient, and reusable. We can hold this PR till I refactor and improve the code. |
…e with other components
…roducts into tearsheet-focus-trap-3499
@elycheea @matthewgallo @Ratheeshrajan @amal-k-joy @lee-chase How to use the hook:
|
3403941
Contributes to #3499
This is to fix the focus trap issue in the Tearsheet component
What did you change?
packages/ibm-products/src/components/Tearsheet/TearsheetShell.js
Implement a 'keydown' event handler
handleKeyDown()
function that handles the 'Tab' key operations. The function checks for focusable elements inside the Tearsheet component and properly navigates the users to the focusable elements in the Tearsheet.Change in the logic of focus claim function
claimFocus()
packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepWithIntro.js
Add
tabIndex
property conditionally to theRadioTile
componentHow did you test and verify your work?
Storybook tested in Chrome, Safari, Firefox, and Edge