diff --git a/lib/commons/standards/implicit-html-roles.js b/lib/commons/standards/implicit-html-roles.js index 6788155ccf..1e077e4446 100644 --- a/lib/commons/standards/implicit-html-roles.js +++ b/lib/commons/standards/implicit-html-roles.js @@ -110,19 +110,8 @@ const implicitHtmlRoles = { } switch (vNode.props.type) { - case 'button': - case 'image': - case 'reset': - case 'submit': - return 'button'; case 'checkbox': return 'checkbox'; - case 'email': - case 'tel': - case 'text': - case 'url': - case '': // text is the default value - return !suggestionsSourceElement ? 'textbox' : 'combobox'; case 'number': return 'spinbutton'; case 'radio': @@ -131,6 +120,22 @@ const implicitHtmlRoles = { return 'slider'; case 'search': return !suggestionsSourceElement ? 'searchbox' : 'combobox'; + + case 'button': + case 'image': + case 'reset': + case 'submit': + return 'button'; + + case 'text': + case 'tel': + case 'url': + case 'email': + case '': + return !suggestionsSourceElement ? 'textbox' : 'combobox'; + + default: + return 'textbox'; } }, // Note: if an li (or some other elms) do not have a required diff --git a/test/commons/aria/implicit-role.js b/test/commons/aria/implicit-role.js index b8edbd2415..074f873bde 100644 --- a/test/commons/aria/implicit-role.js +++ b/test/commons/aria/implicit-role.js @@ -243,6 +243,27 @@ describe('aria.implicitRole', function() { assert.equal(implicitRole(node), 'textbox'); }); + it('should return textbox for "input[type=password]"', function() { + fixture.innerHTML = ''; + var node = fixture.querySelector('#target'); + flatTreeSetup(fixture); + assert.equal(implicitRole(node), 'textbox'); + }); + + it('should return textbox for "input[type=time]"', function() { + fixture.innerHTML = ''; + var node = fixture.querySelector('#target'); + flatTreeSetup(fixture); + assert.equal(implicitRole(node), 'textbox'); + }); + + it('should return textbox for "input[type=date]"', function() { + fixture.innerHTML = ''; + var node = fixture.querySelector('#target'); + flatTreeSetup(fixture); + assert.equal(implicitRole(node), 'textbox'); + }); + it('should return textbox for "input:not([type])"', function() { fixture.innerHTML = ''; var node = fixture.querySelector('#target'); @@ -265,6 +286,14 @@ describe('aria.implicitRole', function() { assert.equal(implicitRole(node), 'textbox'); }); + it('should return textbox for "input[type=password][list]"', function() { + fixture.innerHTML = '' + + ''; + var node = fixture.querySelector('#target'); + flatTreeSetup(fixture); + assert.equal(implicitRole(node), 'textbox'); + }); + it('should return spinbutton for "input[type=number]"', function() { fixture.innerHTML = ''; var node = fixture.querySelector('#target');