-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: autocomplete-appropriate node type resolution #1318
Conversation
* Firefox returns `node.type` as `text` for `type='month'` | ||
* Hence using `node.getAttribute('type')` over `node.type` | ||
*/ | ||
const nodeType = node.hasAttribute('type') ? node.getAttribute('type') : 'text'; |
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.
I agree that we need to use the attribute here rather than the DOM property, but you'll have to normalise it. I don't know exactly what that involves, you can look that up in the spec. It's probably case insensitive. It also needs to default to "text" when there's an invalid value here, not just when type isn't set. Otherwise an element with type="foobar"
wouldn't be allowed to have autocomplete allowed for text.
* @instance | ||
* @return {Array<Sting>} | ||
*/ | ||
axe.utils.validInputTypes = function validInputTypes() { |
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.
This should be assigned to axe.commons.utils, not to axe.utils. Also, I don't think this should be a function. It's inconsistent with how other thing in axe behave.
@@ -0,0 +1,38 @@ | |||
/* global axe */ |
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.
If you create a new commons, please provide tests.
Firefox
returnsnode.type
astext
for certain scenarios like -<input autocomplete="bday-month" type="month">
, hence usinggetAttribute
to resolve the value oftype
solves for this edge case.Due to this, the number of violations returned across different browsers were different as described in the bug below.
Closes issue:
Reviewer checks
Required fields, to be filled out by PR reviewer(s)