-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngAria): Prevent aria-invalid from being added to hidden inputs #15113
Conversation
This fixes a error found using the Google Accessibility Developer Tools audit. Input fields of type hidden shouldn't have aria attributes. https://www.w3.org/TR/html-aria/#allowed-aria-roles-states-and-properties-1
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
We are already excluding all input fields as part of the BTW, the section of the spec you have linked to does not refer to what your PR is about. It refers to elements with a |
The isNodeOneOf check doesn't apply for aria-invalid as allowBlacklistEls is being passed in as true. The test I wrote will fail without the code change. The relevant row in the spec reads as follows: |
Sorry, I read this incorrectly. I am reopening and will review soon. |
@@ -420,6 +420,11 @@ describe('$aria', function() { | |||
scope.$apply('txtInput=\'LTten\''); | |||
expect(element.attr('aria-invalid')).toBe('userSetValue'); | |||
}); | |||
|
|||
it('should not attach if input is hidden', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: It would be more clear to say: ...if input is type="hidden"
LGTM (but we still need a signed CLA to merge). |
Thanks for taking a look @gkalpak. I signed the CLA as a company: BookingBug. |
@IgorMinar (or someone else), can you verify the CLA? |
@gkalpak BookingBug is good! 👍 |
Actually, I am going to mark this as a breaking change and merge it into 1.6 only. It might break tests (unlikely but possible). |
We decided not to add more breaking changes into 1.6 at this point, so moving this to 1.7. |
LGTM2 and it can be merged because master is on 1.7 |
Actually, I just realized that -while the the spec only mentions |
@edclements it's been a while but are you still interested / available to make the changes required for this PR? See #15113 (comment) |
This fixes a error found by @edclements using the Google Accessibility Developer Tools audit. Input fields of type hidden shouldn't have aria attributes. https://www.w3.org/TR/html-aria/#allowed-aria-roles-states-and-properties-1 Closes angular#15113
I've created an updated PR here: #16367 No need to update this PR anymore. Thanks @edclements for getting this on the road. |
This fixes a error found by @edclements using the Google Accessibility Developer Tools audit. Input fields of type hidden shouldn't have aria attributes. https://www.w3.org/TR/html-aria/#allowed-aria-roles-states-and-properties-1 Closes #15113 Closes #16367 BREAKING CHANGE: ngAria no longer sets aria-* attributes on input[type="hidden"] with ngModel. This can affect apps that test for the presence of aria attributes on hidden inputs. To migrate, remove these assertions. In actual apps, this should not have a user-facing effect, as the previous behavior was incorrect, and the new behavior is correct for accessibility.
This fixes a error found using the Google Accessibility Developer Tools audit.
Input fields of type hidden shouldn't have aria attributes.
https://www.w3.org/TR/html-aria/#allowed-aria-roles-states-and-properties-1