[docs][stepper] Fix focus management in examples#48494
Open
silviuaavram wants to merge 6 commits intomui:masterfrom
Open
[docs][stepper] Fix focus management in examples#48494silviuaavram wants to merge 6 commits intomui:masterfrom
silviuaavram wants to merge 6 commits intomui:masterfrom
Conversation
9f4162b to
2d480b7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates several Stepper documentation demos to preserve keyboard focus when step transitions disable or remove the currently focused button, by programmatically moving focus to an appropriate remaining control.
Changes:
- Added focus-management
refs anduseEffectlogic to Horizontal/Vertical Stepper demos to move focus to Next/Back/Reset during step transitions. - Added similar focus-management to MobileStepper demos (dots/progress/text) when reaching the first/last step where one control becomes disabled.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/data/material/components/steppers/VerticalLinearStepper.tsx | Adds refs + effect to focus Continue/Back/Reset across step changes |
| docs/data/material/components/steppers/VerticalLinearStepper.js | JS equivalent of the VerticalLinearStepper focus changes |
| docs/data/material/components/steppers/HorizontalNonLinearStepper.tsx | Adds refs + effects to focus Reset/Next on completion/reset and when navigating back to step 1 |
| docs/data/material/components/steppers/HorizontalNonLinearStepper.js | JS equivalent of the HorizontalNonLinearStepper focus changes |
| docs/data/material/components/steppers/HorizontalLinearStepper.tsx | Adds refs + effect to focus Reset/Next for finish/reset/skip flows |
| docs/data/material/components/steppers/HorizontalLinearStepper.js | JS equivalent of the HorizontalLinearStepper focus changes |
| docs/data/material/components/steppers/DotsMobileStepper.tsx | Adds refs + effect to focus Next/Back when reaching first/last step |
| docs/data/material/components/steppers/DotsMobileStepper.js | JS equivalent of the DotsMobileStepper focus changes |
| docs/data/material/components/steppers/ProgressMobileStepper.tsx | Adds refs + effect to focus Next/Back when reaching first/last step |
| docs/data/material/components/steppers/ProgressMobileStepper.js | JS equivalent of the ProgressMobileStepper focus changes |
| docs/data/material/components/steppers/TextMobileStepper.tsx | Adds refs + effect to focus Next/Back when reaching first/last step |
| docs/data/material/components/steppers/TextMobileStepper.js | JS equivalent of the TextMobileStepper focus changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploy previewhttps://deploy-preview-48494--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
1 task
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.
This PR addresses focus loss that occurs in interactive Stepper demos when the focused button is removed or disabled after a step transition.
Cases fixed per demo:
Also adds aria-labels to the two examples showing a progress indicator: