question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DatePicker] Accessibility issue regarding heading

See original GitHub issue

Kitty Cat fix

Environment

Tech Version
@material-ui/pickers 3.2.10
material-ui 4.95
TypeScript n/a
React 16.8.6
Browser All
Peer library moment 2.4.0

Steps to reproduce

For the following steps I am referring to: Keyboard input masked time picker

  1. Go to the demo for timepicker, section for Keyboard input linked above and open up the modal using the calendar icon button, opening up to large numbers showing 4:45AM/PM.
  2. Chrome inspect the DOM Elements associated with the Toolbar Button / Toolbar Text Components (Example: 4, 45, AM, or PM text elements).
  3. Observe the associated element for the time (4 or 45). It produces an element of h2 with a className of MuiTypography-root MuiPickersToolbarText-toolbarTxt MuiPickersToolbarText-toolbarBtnSelected MuiTypography-h2

Expected behavior

The DOM elements for the Toolbar Text / Toolbar button should not be part of the heading structure.

Actual behavior

The toolbar text button uses an h2 variant, as a result the component is then changed to be an h2. I have noticed it with all elements throughout all the pickers, anytime a variant of h1…h6 is provided.

Live example

Keyboard input masked time picker While this is the demo site, the behavior persists on my codebase and causes a disruption to my heading structure.

Additional Notes

This issue seems to be widespread, but has a base issue within toolbar text. So I think solving it in that component, would reflect changes in all the components.

An additional way to test is by inspecting with Chrome and running document.querySelectorAll(“h1, h2, h3, h4, h5, h6”) in the console. I did this as a quick test and noted that the headings jump around quite a bit and do not follow an expected order.

I am open to contributing if it helps. Within the component here: material-ui-pickers/lib/src/_shared/ToolbarText.tsx, pass over a component of span for Typography to render.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
gracektaycommented, Dec 30, 2020

@eps1lon Based on my experience, less headings is better than broken😊. Much like ARIA, unless you can do it perfectly it can do more harm than good unless you REALLY know what you’re doing. Anyways, thanks we’re looking forward to v5 on our team (or at least I am)!!! I’d also be happy to help with triage, it looks like stack overflow would be a good place to look too maybe?

1reaction
eps1loncommented, Dec 30, 2020

I think generally we shouldn’t use any heading elements in components. It’s too easy to break the heading structure this way.

This begs the question what’s worse: a broken heading structure or no/too little heading structure. But this is a more general question that doesn’t need to be answered here. All the advise I saw was “don’t break the heading structure” so we stick to it until we learn otherwise.

I’ll check out the issues every now and then and see how I may help, but feel free to tag me if there is something more pressing in your roadmap!

It’s a continuous effort. Our biggest problem is triaging issues and making them reproduceable. Most of the time it’s some validator that complains which is an issue but it’s more important how actual assistive technology (e.g. screen readers) behave.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[DatePicker] Accessibility issue regarding heading #24174
This issue seems to be widespread, but has a base issue within toolbar text. So I think solving it in that component, would...
Read more >
Date Picker Dialog Example | WAI-ARIA Authoring Practices 1.1
Refers to the heading containing the currently displayed month and year, which defines the accessible name for the dialog. aria-live="polite", div. Indicates ...
Read more >
jQuery UI datepicker accessibility fail - Stack Overflow
jQuery UI datepicker accessibility fail ... I'm using the jQuery UI datepicker widget (see API docs), but our accessibility compliance checker is complaining ......
Read more >
Accessible Datepickers Roundup - DigitalA11Y
Accessible date pickers or accessible calendar widgets as they are commonly referred to, are one of the most discussed topics between developers, designers....
Read more >
Accessibility - Date picker - Carbon Design System
Automated, manual and screen reader accessibility verification test has been performed on the date picker React Carbon component.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found