fix(Spinner): prevent keyboard focus on hidden children via inert att… - #809
Open
kimiaShahbaghi wants to merge 1 commit into
Open
fix(Spinner): prevent keyboard focus on hidden children via inert att…#809kimiaShahbaghi wants to merge 1 commit into
kimiaShahbaghi wants to merge 1 commit into
Conversation
|
@kimiaShahbaghi is attempting to deploy a commit to the WorkOS Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
loadingis true andchildrenare provided,Spinnerwraps the children in a hidden span to preserve the button's size during the loading state:inert={undefined}in React removes the attribute from the DOM entirely — it is a no-op. This means any focusable element passed as a child (a button, link, input, etc.) can still receive keyboard focus via Tab while it is visually hidden and removed from the accessibility tree.The codebase already has a purpose-built helper at
src/helpers/inert.tsthat handles the React 18 vs 19 difference for theinertattribute. It is used correctly in bothSkeletonandThemePanel.Spinneris the only loading component that doesn't use it.This PR replaces
inert={undefined}withinert={inert}(the existing helper), consistent with the pattern already inskeleton.tsx.Testing steps
pnpm devand openhttp://localhost:3000/sinkButtonwith a loading spinner that has focusable children (or create one):Relates issues / PRs
N/A