-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(#1231) fix(#1070) A11y: add minimum/maximum labels, use output for displayValue #1148
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
Conversation
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.
It didn't create an artifact and when I use c3e17c6d951594fa4f4c99312bde4a97d948a6e1
in an existing url it doesn't work.
* governing permissions and limitations under the License. | ||
*/ | ||
|
||
import csCZ from './cs-CZ.json'; |
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 thought we did import intlMessages from '../intl/*.json';
instead of index.js files?
Is this related to having translation files that aren't in this index.js?
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.
In this case, I import intlMessages
into @react-spectrum/slider/src/SliderBase.tsx
at line 15, rather than useSliderThumb
, because there doesn't seem to be a way to return the appropriate aria-label
for the minimum
or maximum
thumb from useSliderThumb
. Each thumb knows nothing about the other thumbs.
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've refactored so that the i18n gets added in useSliderThumb
.
…layValue Pressing the displayValue should focus the corresponding input. fix(adobe#1070) A11y: updates per code review Co-Authored-By: Robert Snow <[email protected]>
a0f9151
to
2ff4fdb
Compare
…pdate Slider (hook) stories Co-Authored-By: Robert Snow <[email protected]>
…necessary Co-Authored-By: Robert Snow <[email protected]>
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 also noticed that the accessibility name (and what was announced by VoiceOver) for the thumbs was "Slider [value of slider]", no "Maximum" or "Minimum" (the aria label was correct though, and aria-labelledby correctly had the input id appended to the end). Confirmed that the rest of what you noted in the repro steps was correct though.
Is this correct? Screenshot below shows the aria-label crossed out in the accessibility dev tool section
Otherwise, just some small things/questions
{ | ||
"maximum": "الحد الأقصى", | ||
"minimum": "الحد الأدنى" | ||
} |
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 presume these translations were vetted by the localization team or came from a prior source that was vetted?
if (state.values.length === 2 && !ariaLabel) { | ||
if (index === 0) { | ||
ariaLabel = formatMessage('minimum'); | ||
} else if (index === 1) { | ||
ariaLabel = formatMessage('maximum'); | ||
} | ||
} |
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.
Perhaps overkill for now, but should this account for cases that have more than 2 slider thumbs? I guess it would just need to check that index === state.value.length - 1
for maximum.
Not sure if it is appropriate though, perhaps these aria messages are for range sliders only
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'm also not sure if we should put this here as it kinda assumes that all two-thumbed sliders are range sliders. IMO the labels should go in Spectrum RangeSlider since we don't have a range specific aria hook.
div[style='isolation: isolate; color-scheme: dark;'] .label { | ||
color: #b0b0b0; | ||
} | ||
|
||
div[style='isolation: isolate; color-scheme: dark;'] .value { | ||
color: #9a9a9a; | ||
} | ||
|
||
div[style='isolation: isolate; color-scheme: dark;'] .label { | ||
color: #b0b0b0; | ||
} | ||
|
||
div[style='isolation: isolate; color-scheme: dark;'] .value { | ||
color: #9a9a9a; | ||
} |
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 like you have two sets of the same style here
I'm going to refactor this slightly and send a separate PR later today. Three issues:
|
Co-authored-by: Daniel Lu <[email protected]>
This seems to be a Chromium bug, that I can reproduce: https://codepen.io/majornista/pen/QWKpYrR. Safari seems to be behaving correctly. I can work around it by referencing another element, other than the input, like the handle container element for example, to provide the aria-label for the input. |
…" (#1397) * Revert "Slider accessibility name calculation fixes for Chrome (#1148) (#1389)" This reverts commit f8e2bee. * Update packages/@react-spectrum/color/test/ColorSlider.test.tsx Co-authored-by: Danni <[email protected]>
…#1148)" (adobe#1397) * Revert "Slider accessibility name calculation fixes for Chrome (adobe#1148) (adobe#1389)" This reverts commit f8e2bee. * Update packages/@react-spectrum/color/test/ColorSlider.test.tsx Co-authored-by: Danni <[email protected]>
Pressing the displayValue should focus the corresponding input.
Closes #1231
Relates to #1070
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: