💼 This rule is enabled in the following configs: ✅ recommended, strict-gjs, strict-gts.
🔧 This rule is automatically fixable by the --fix CLI option.
Disallows redundant role attributes on semantic HTML elements.
The rule checks for redundancy between any semantic HTML element with a default/implicit ARIA role and the role provided.
For example, if a landmark element is used, any role provided will either be redundant or incorrect. This rule ensures that no role attribute is placed on any of the landmark elements, with the following exceptions:
- a
navelement with thenavigationrole to make the structure of the page more accessible to user agents - a
formelement with thesearchrole to identify the form's search functionality - a
inputelement withcomboboxrole to identify the input as a combobox
This rule forbids the following:
This rule allows the following:
This rule accepts an options object with the following properties:
checkAllHTMLElements(default:true) - When set totrue, checks all HTML elements for redundant roles. Whenfalse, only checks landmark elements.
// .eslintrc.js
module.exports = {
rules: {
'ember/template-no-redundant-role': ['error', { checkAllHTMLElements: false }],
},
};