elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.77k stars 8.17k forks source link

[Dashboard management UI][SCREEN READER]: Dual range slider inputs need accessible labels that include the `prepended` string #183202

Open 1Copenut opened 4 months ago

1Copenut commented 4 months ago

Description The dual range slider in the Dashboard UI do not have meaningful, semantic labels. The underlying EuiDualRangeSlider component has the ability to add ARIA attributes into the minInputProps and maxInputProps, so I think we can construct meaningful labels. I've included a screenshot and relevant code snippets to (hopefully) make the ask clear.

Steps to reproduce

  1. Start a screen reader of your choosing
  2. Log into a QA environment and open a new classic Deployment
  3. Turn on the sample dashboards and navigate to one. I used the E-commerce sample data for this demo.
  4. Tab through until the Quantity slider has focus. Make sure the first input has the focus.
  5. Verify the input is announced as a spinbox or number input, but the "Quantity" label is never read

Screenshots

Screenshot 2024-05-10 at 4 32 53 PM

Proposed solution The EuiDualRangeSlider allows for the ARIA attributes we need. I want to add an aria-label to each input, and an ID to each input and the prepended string. This will allow us to concatenate the prepended text with the input's accessible label to make each one more meaningful.

See range_slider_control.tsx#L199

! range_slider_control.tsx

minInputProps={{
  ...getCommonInputProps({
    inputValue: displayedValue[0],
    testSubj: 'lowerBoundFieldNumber',
    placeholder: String(min ?? -Infinity),
  }),
+ "aria-label": "minimum value" // or another value that makes sense and is internationalized
+ "aria-labelledby": "PREPENDED_ID THIS_MIN_ID"
+ id="THIS_MIN_ID"
}}
maxInputProps={{
  ...getCommonInputProps({
    inputValue: displayedValue[0],
    testSubj: 'lowerBoundFieldNumber',
    placeholder: String(min ?? -Infinity),
  }),
+ "aria-label": "maximum value" // or another value that makes sense and is internationalized
+ "aria-labelledby": "PREPENDED_ID THIS_MAX_ID"
+ id="THIS_MAX_ID"
}}

Actual Result

Expected Result

Kibana Version: 8.14.0

OS: MacOS

Browser: Chrome latest

Screen reader VoiceOver

Relevant WCAG Criteria:

elasticmachine commented 4 months ago

Pinging @elastic/kibana-accessibility (Project:Accessibility)

elasticmachine commented 4 months ago

Pinging @elastic/kibana-presentation (Team:Presentation)