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

ngAria should check for interactive child elements before binding role=button and tabindex=0 #14672

Closed
@marcysutton

Description

@marcysutton

I've seen this bug in the wild on a large web application using ngAria: ng-click tries to help accessibility by binding role="button" and tabindex="0", unless opted out. The problem is if that DIV with an ng-click wraps another interactive element such as <button> or <a>, the extra tabindex and role cause problems.

Current behavior

tabindex="0" on everything causes keyboard hell with often-redundant tab stops; and the role=button wrapping other content confuses screen reader users.

Here is a Plunker showing the wrapping interactive elements, prompted from #14665: https://plnkr.co/edit/SPxQ0X2RQvvfvAmDVTNA?p=preview

What is the expected behavior?

If we can do it fast enough, ngAria should test an ng-click target's child elements against the nodeBlacklist and return false on the first instance, leaving off tabindex="0" and role="button". The DIV with ng-click will then stay a mouse-only element to prevent degrading accessibility in the rest of that DOM subtree.

What is the motivation / use case for changing the behavior?

ngAria currently causes more problems than it solves with "fixes" like the one ng-click tried to solve. Addressing this problem would improve the utility of the library.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

Visible in the latest version.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions