-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
BorderControl: Update labelling, tooltips and wrap with fieldset and legend #42348
Conversation
@@ -85,6 +91,8 @@ const UnconnectedBorderControl = ( | |||
__next36pxDefaultSize={ __next36pxDefaultSize } | |||
/> | |||
<UnitControl | |||
label={ __( 'Border width' ) } |
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.
Should the labels for the inner UnitControl
and RangeControl
be labelled differently when they are both for controlling the same thing i.e. "Border width"?
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.
I think it's ok that they are the same, since the distinction is made by the screen reader when it says the role ("stepper" vs. "slider"). Though I'll defer to @afercia if there are better ways.
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.
I'll look to merge these improvements later today but am happy to tweak the labels further in a follow-up if desired.
Size Change: +382 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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.
Thanks for addressing this so quickly! We need to tweak the padding thing, but otherwise the changes look good to me.
packages/components/src/border-control/border-control/component.tsx
Outdated
Show resolved
Hide resolved
@@ -85,6 +91,8 @@ const UnconnectedBorderControl = ( | |||
__next36pxDefaultSize={ __next36pxDefaultSize } | |||
/> | |||
<UnitControl | |||
label={ __( 'Border width' ) } |
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.
I think it's ok that they are the same, since the distinction is made by the screen reader when it says the role ("stepper" vs. "slider"). Though I'll defer to @afercia if there are better ways.
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.
Looks great 🚀
Missing changelog incoming via: #42411 |
Related:
What?
Updates the
BorderControl
component to improve labelling, DOM structure, and tooltips.Note: Improvements to the
BorderBoxControl
will be addressed in a separate PRWhy?
Accessibility is important.
How?
BorderControl
wrapping element to afieldset
and its primary label to alegend
UnitControl
andRangeControl
componentsgetByRole
andqueryByRole
calls in unit tests to also filter by nameTesting Instructions
npm run test-unit /packages/components/src/border-control/test
BorderControl
still functions correctly