Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

input: ngAria adds role 'button' to placeholder label, confusing screen readers #11293

@hintzed

Description

@hintzed

Bug, enhancement request, or proposal:

Bug

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue:

https://codepen.io/anon/pen/WJmmXd

Detailed Reproduction Steps:

  1. Add an input element with a placeholder attribute.
  2. Inspect the generated floating placeholder label in the DOM for aria attributes.
  3. (Optional) Use ChromeVox on ChromeOS to iterate through the list of buttons (see shortcuts). Notice how the input field is selected and announced as a clickable button element.

image

What is the expected behavior?

The placeholder label should not be an interactive UI element in the accessibility tree.

What is the current behavior?

The placeholder label is assigned the aria role "button" and thus considered a button by accessibility tools.

What is the use-case or motivation for changing an existing behavior?

Being classified as button in the accessibility tree causes screen readers such as ChromeVox to jump to it and announce it as an interactive element of role button when navigating a page by element category button. This makes navigation an application using accessibility tools like screen readers confusing. It is working fine when just tabbing through the focusable elements, due to having an tabindex=-1, though.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.6.9
  • AngularJS Material: 1.1.9
  • OS: all
  • Browsers: all

Is there anything else we should know? Stack Traces, Screenshots, etc.

This issue is caused by ngAria adding role='button' by default to elements with an ngClick directive that aren't natively clickable (see aria.js). It is triggered by the ngClick directive on the label used to display the placeholder text (see input.js).

While one can globally disable this behavior by ngAria by setting bindRoleForClick=false, doing so could likely cause a regression in terms of accessibility in other places.

Assuming that the placeholder label element itself is no particular use to say a screen reader user (assuming the aria-label on the actual input element is set to a meaningful value, perhaps even the placeholder value) and the purpose of the ngClick directive only being to redirect focus to the actual input element, adding aria-hidden="true" to the placeholder label element might be an appropriate solution to resolve this issue.

Metadata

Metadata

Assignees

Labels

P3: importantImportant issues that really should be fixed when possible.a11yThis issue is related to accessibilitybrowser: Chromeg3: reportedThe issue was reported by an internal or external product team.has: Pull RequestA PR has been created to address this issueresolution: fixedtype: bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions