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(chrome): prevent focus on closed Sheet #1920

Merged
merged 2 commits into from
Sep 11, 2024
Merged

Conversation

jzempel
Copy link
Member

@jzempel jzempel commented Sep 11, 2024

Description

Applies inert attribute when the Sheet is closed in order to prevent tab focus through the sheet's interactive elements.

Checklist

  • 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • 🌐 demo is up-to-date (npm start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • renders as expected in dark mode
  • 🤘 renders as expected with Bedrock CSS (?bedrock)
  • 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • ♿ tested for WCAG 2.1 AA accessibility compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

@jzempel jzempel requested a review from a team as a code owner September 11, 2024 16:13
@@ -51,6 +51,7 @@ const SheetComponent = React.forwardRef<HTMLElement, ISheetProps>(
return (
<SheetContext.Provider value={sheetContext}>
<StyledSheet
inert={isOpen ? undefined : ''}
Copy link
Contributor

@ze-flo ze-flo Sep 11, 2024

Choose a reason for hiding this comment

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

Adding a mental note that this might break with React@19.x:

facebook/react#17157 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

using an empty string feels wrong anyway lol glad they're fixing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

the unit tests should tell us if the fix breaks Garden's code

@jzempel jzempel merged commit 403b70d into main Sep 11, 2024
8 checks passed
@jzempel jzempel deleted the jzempel/inert-sheet branch September 11, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants