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
docs(material/stepper): expand a11y section #23617
Conversation
src/material/stepper/stepper.md
Outdated
@@ -222,3 +222,19 @@ is given `role="tab"`, and the content that can be expanded upon selection is gi | |||
step content is automatically set based on step selection change. | |||
|
|||
The stepper and each step should be given a meaningful label via `aria-label` or `aria-labelledby`. | |||
|
|||
When a stepper is used on a smaller screen, verical steppers are preferred over |
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.
verical -> vertical
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.
Prefer vertical steppers when building for small screen sizes, as horizontal steppers typically take up significantly more horizontal space, thus introducing horizontal scrolling. Applications with multiple scrolling dimensions make content harder to consume for some users. See the [Responsive Stepper section](#responsive-stepper) above for an example on building a stepper that adjusts its layout based on viewport size.
- Eliminates passive voice (e.g. "stepper is used", "steppers are preferred")
- Adds some context on why folks would want to be careful with horizontal steppers on small screens
- Links to the example above
src/material/stepper/stepper.md
Outdated
@@ -222,3 +222,19 @@ is given `role="tab"`, and the content that can be expanded upon selection is gi | |||
step content is automatically set based on step selection change. | |||
|
|||
The stepper and each step should be given a meaningful label via `aria-label` or `aria-labelledby`. | |||
|
|||
When a stepper is used on a smaller screen, verical steppers are preferred over | |||
horizontal steppers because the text in the header will be more visible. |
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.
Might be worth mentioning here that there's an example of a responsive stepper further up in the doc.
src/material/stepper/stepper.md
Outdated
horizontal steppers because the text in the header will be more visible. | ||
|
||
#### Forms | ||
Steppers often have forms inside of it. It's best practice for form fields to |
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.
inside of it -> inside of them
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.
Steppers often have forms inside of it. It's best practice for form fields to | |
Steppers often contain forms and form controls. If validation errors inside of a stepper's form prevents moving to another step, make sure that your form controls communicate error messages to assistive technology. This helps the user know why they can't advance to another step. You can accomplish this by using `<mat-error>` with `<mat-form-field>`, or by using an ARIA live region. |
- Changes for passive voice and grammar
- Clarify that
<mat-error>
is one possible way to communicate updates
src/material/stepper/stepper.md
Outdated
|
||
#### Forms | ||
Steppers often have forms inside of it. It's best practice for form fields to | ||
have `<mat-error>` for fields that can be incorrect and throw an error. |
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.
nit: I'm not sure that "throw an error" is the correct terminology here since it sounds like there was an actual runtime error, whereas these are validation errors.
src/material/stepper/stepper.md
Outdated
@@ -222,3 +222,19 @@ is given `role="tab"`, and the content that can be expanded upon selection is gi | |||
step content is automatically set based on step selection change. | |||
|
|||
The stepper and each step should be given a meaningful label via `aria-label` or `aria-labelledby`. | |||
|
|||
When a stepper is used on a smaller screen, verical steppers are preferred over |
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.
Prefer vertical steppers when building for small screen sizes, as horizontal steppers typically take up significantly more horizontal space, thus introducing horizontal scrolling. Applications with multiple scrolling dimensions make content harder to consume for some users. See the [Responsive Stepper section](#responsive-stepper) above for an example on building a stepper that adjusts its layout based on viewport size.
- Eliminates passive voice (e.g. "stepper is used", "steppers are preferred")
- Adds some context on why folks would want to be careful with horizontal steppers on small screens
- Links to the example above
src/material/stepper/stepper.md
Outdated
horizontal steppers because the text in the header will be more visible. | ||
|
||
#### Forms | ||
Steppers often have forms inside of it. It's best practice for form fields to |
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.
Steppers often have forms inside of it. It's best practice for form fields to | |
Steppers often contain forms and form controls. If validation errors inside of a stepper's form prevents moving to another step, make sure that your form controls communicate error messages to assistive technology. This helps the user know why they can't advance to another step. You can accomplish this by using `<mat-error>` with `<mat-form-field>`, or by using an ARIA live region. |
- Changes for passive voice and grammar
- Clarify that
<mat-error>
is one possible way to communicate updates
src/material/stepper/stepper.md
Outdated
When you navigate away from a step with an error in a non-linear stepper, the | ||
error message appears in the step header. Announcing the error with | ||
`liveAnnouncer` will help screen reader users know that the step they just | ||
navigated away from has an error. |
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.
When you navigate away from a step with an error in a non-linear stepper, the | |
error message appears in the step header. Announcing the error with | |
`liveAnnouncer` will help screen reader users know that the step they just | |
navigated away from has an error. | |
When a step contains a forms validation error, `MatStepper` will display the error in the step's header. For non-linear steppers, you should use an ARIA live region to announce error messages when users navigate away from a step with an error message. |
Is this accurate to what you're trying to get across?
4788383
to
264dee4
Compare
Thanks for the comments! |
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.
lgtm aside from one typo (which probably came from me)
you can mark this PR as "merge ready" when done
src/material/stepper/stepper.md
Outdated
@@ -222,3 +222,23 @@ is given `role="tab"`, and the content that can be expanded upon selection is gi | |||
step content is automatically set based on step selection change. | |||
|
|||
The stepper and each step should be given a meaningful label via `aria-label` or `aria-labelledby`. | |||
|
|||
Prefer verticl steppers when building for small screen sizes, as horizontal | |||
steppers typically take up significantly more horizontal space thus introducing |
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.
steppers typically take up significantly more horizontal space thus introducing | |
steppers typically take up significantly more horizontal space thus introduce |
264dee4
to
d3325bf
Compare
(cherry picked from commit 8c81fb7)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.