Skip to content
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

axe should be aware of input type default of text #2514

Closed
schne324 opened this issue Sep 10, 2020 · 5 comments
Closed

axe should be aware of input type default of text #2514

schne324 opened this issue Sep 10, 2020 · 5 comments
Labels
commons Issues in the common code (lib/commons) fix Bug fixes good first issue For first-time contributors hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/

Comments

@schne324
Copy link
Member

regarding input type...

If this attribute is not specified, the default type adopted is text.

from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input

example markup:

<input ng-repeat="input in inputCtrl" ng-style="{'width': input.css + '%'}" class="input-md _1DEW order-number landing-input-1 sidebar-input-number ng-touched" ng-class="{ 'input-error': $ctrl.showError }" type="input.type" aria-label="Order Number" aria-describedby="loginErrorTooltip" data-test="input-number" placeholder="" ng-required="input.is_required" ng-model="$ctrl.modelObject[input.name]" ng-change="$ctrl.updateLandingForm(input.name, $ctrl.modelObject[input.name])" style="width: 98%;">

(from https://returns.narvar.com/reionline/returns)

Expectation: getRole(document.querySelector('input')) should return textbox

Actual: getRole(document.querySelector('input')) returns null

I can tell this is because the above input, has an invalid type of input.type 🤦 but it appears that all browsers treat that invalid type attribute value as the same as not having it present at all (which defaults to text). I've tested this rei page out with safari + vo and inspected a11y trees in the 3 major browsers.

Motivation: 🤷


axe-core version:4.0.2


Browser and Assistive Technology versions


For Tooling issues:
- Node version: XX  
- Platform:  
@straker
Copy link
Contributor

straker commented Sep 10, 2020

Should be an easy fix. Instead of looking at the type attribute as we do now, we should look at the vNode.props.type property which is already calculated to respect valid types and default to text

@straker straker added commons Issues in the common code (lib/commons) fix Bug fixes good first issue For first-time contributors labels Sep 10, 2020
@straker straker added the hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/ label Oct 1, 2020
@shankarshastri
Copy link
Contributor

@straker , I can take a look at this one !!

@straker
Copy link
Contributor

straker commented Oct 5, 2020

Awesome. Let me know if you need anything.

@shankarshastri
Copy link
Contributor

I went ahead with the approach you suggested above, by changing
switch ((vNode.attr('type') || '').toLowerCase()) { to
switch ((vNode.props.type || '').toLowerCase()) {

@straker , Any thoughts on how I can test the change?

@straker
Copy link
Contributor

straker commented Oct 5, 2020

Yep, we have a test file for implicit roles that you can make sure an invalid input type returns as textbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commons Issues in the common code (lib/commons) fix Bug fixes good first issue For first-time contributors hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

No branches or pull requests

3 participants