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.

TextField variant="outlined" has embedded accessibility issue

See original GitHub issue

I have been scanning our app for accessibility issues with the IBM Accessibility Chrome plugin in WCAG 2.1 (A,AA) compliance mode. The tool found an issue in the following component <TextField label="Outlined" variant="outlined" />. It can even be reproduced/detected on the official Material-UI demo page.

The detected problem is that <fieldset> element does not have a <legend>. Looking at the generated HTML, I can see that the there’s a legend within the fieldset, however its style has visibility: hidden, which would hide it from screen readers. visibility-hidden accessibility-issue

I’m attaching screenshots of the issue.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The legend has style visibility: hidden which prevents it from screen readers.

Expected Behavior 🤔

The legend is styled differently so that visibility is not hidden. I have tried to override the style in a theme (code below), but that introduced other CSS incompatibilities:

export const defaultTheme = createMuiTheme({
  overrides: {
    PrivateNotchedOutline: {
      legendLabelled: {
        // // Make it visible the hard way for accessibility - https://webaim.org/techniques/css/invisiblecontent/
        visibility: "inherit !important",
        position: "absolute", // This adds more padding to the outlined text field :(
        left: "-10000px",
        top: "auto",
        width: "1px",
        height: "1px",
        overflow: "hidden",
        color: "black",
      },
    },
  }
});

Your Environment 🌎

Tech Version
Material-UI v4.11.0
React v16.13.1
Browser Chrome
TypeScript 4.0.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
eps1loncommented, Aug 29, 2020

There’s some discussion in ARIA related repos that assistive technology should be allowed to ignore aria-hidden where it’s used wrongly and this might be such an instance. Since the fieldset is visible aria-hidden might be considered a mistake. Since we do use it presentational and not to group form elements role="presentation" might be “more correct”.

Though in the end it’s more important to fix issues with assistive technology not with 3rd party tools. We can certainly report their defects but we can’t be burdened with fixing it for them as well. We simply don’t have the bandwidth for that.

1reaction
eps1loncommented, Aug 28, 2020

Thanks for the report!

This fieldset is for styling purposes only i.e. decorative. Did you find an issue that impacts actual assistive technology like screen readers?

Maybe we should just mark the fieldset as role="presentation" since that’s what it is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextField variant="outlined" has embedded accessibility issue
I have been scanning our app for accessibility issues with the IBM Accessibility Chrome plugin in WCAG 2.1 (A,AA) compliance mode.
Read more >
Can't change border radius of text-field variant=filled in ...
I wasn't able to access the outline container which applies the borderRadius, so I used the CSS approach instead. <TextField ...
Read more >
Web Content Accessibility Guidelines (WCAG) 2.2 - W3C
Web Content Accessibility Guidelines (WCAG) 2.2 covers a wide range of recommendations for making Web content more accessible.
Read more >
React Text Field component - Material UI - MUI
The TextField wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), ......
Read more >
Pure CSS Material Outlined Textfield - CodePen
A semantic CSS only implementation of Material Design Outlined Textfield that works on Chrome, Safari, Firefox, Samsung Internet and Edge. Use it freel......
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