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

feat(ngAria): add support for ignoring a specific element #14833

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Jun 27, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

What is the current behavior? (You can also link to an open issue here)
It is not possible to force ngAria to "ignore" a specific element, i.e. not add aria-* attributes, attach roles, bind keyboard events etc. The only work-around is to provide those attributes yourself (in which case ngAria won't overwrite them), but this is tedious and doesn't work for all usecases.

What is the new behavior (if this is a feature change)?
It is possible to force ngAria to "ignore" a specific element, by adding the ng-aria-disable attribute.

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

Other information:
Fixes #14602
Fixes #14672

@gkalpak
Copy link
Member Author

gkalpak commented Jun 27, 2016

/cc @marcysutton

Notes:

  • The current implementation will only ignore the specific element, not the whole subtree. I thought about adding support for ignoring the whole subtree, but:
    1. The implementation would be more involved (e.g. we might need to traverse up the DOM looking for an attribute or we could have a directive and require its controller from all ngAria directives).
    2. Unless there is a strong (valid) usecase, we should not promote (or make it easy) to disable ngAria in large parts of the DOM.
  • A possible future enhancement is to disable specific features. E.g. ng-aria-disable="ariaHidden, bindRoleForClick, tabindex".

@marcysutton
Copy link
Contributor

I like this idea; it would also help to address the config being global in #11174.

It makes sense that disabling would only work for that specific node...crawling DOM subtrees would be too expensive. I like the future enhancement of disabling certain features, that was my one question after reviewing the PR.

@gkalpak gkalpak modified the milestones: Backlog, 1.7.x May 9, 2018
@gkalpak gkalpak self-assigned this May 9, 2018
@petebacondarwin petebacondarwin self-assigned this May 14, 2018
@Narretz
Copy link
Contributor

Narretz commented Jun 6, 2018

LGTM, but must be rebased (and possibly updated if something has been added to ngAria)

@gkalpak gkalpak force-pushed the feat-ngAria-support-opting-out branch from 3c67f1d to 4a7a438 Compare June 7, 2018 13:59
@gkalpak
Copy link
Member Author

gkalpak commented Jun 7, 2018

Rebased. (AFAICT, nothing has been added to ngAria that is not accounted for.)

@gkalpak gkalpak closed this in db584f7 Jun 8, 2018
gkalpak added a commit that referenced this pull request Jun 8, 2018
@gkalpak gkalpak deleted the feat-ngAria-support-opting-out branch June 8, 2018 13:17
@Splaktar
Copy link
Member

Just in case anyone (like me) is looking for when this feature was released, it was first available in 1.7.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.