You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/template-no-redundant-role.md
+24-31Lines changed: 24 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@
4
4
5
5
<!-- end auto-generated rule header -->
6
6
7
-
Disallows redundant role attributes on semantic HTML elements.
8
-
9
7
The rule checks for redundancy between any semantic HTML element with a default/implicit ARIA role and the role provided.
10
8
11
9
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:
@@ -18,56 +16,51 @@ For example, if a landmark element is used, any role provided will either be red
This rule accepts an options object with the following properties:
58
-
59
-
-`checkAllHTMLElements` (default: `true`) - When set to `true`, checks all HTML elements for redundant roles. When `false`, only checks landmark elements.
55
+
- boolean -- if `true`, default configuration is applied
- boolean -- `checkAllHTMLElements` -- if `true`, the rule checks for redundancy between any semantic HTML element with a default/implicit ARIA role and the role provided, instead of just landmark roles (default: `true`)
errors: [{message: 'Use of redundant or invalid role: listbox on <select> detected.'}],
237
245
},
246
+
{
247
+
code: '<main role="main"></main>',
248
+
output: '<main></main>',
249
+
options: [{checkAllHTMLElements: false}],
250
+
errors: [
251
+
{
252
+
message:
253
+
'Use of redundant or invalid role: main on <main> detected. If a landmark element is used, any role provided will either be redundant or incorrect.',
254
+
},
255
+
],
256
+
},
257
+
{
258
+
code: '<aside role="complementary"></aside>',
259
+
output: '<aside></aside>',
260
+
options: [{checkAllHTMLElements: false}],
261
+
errors: [
262
+
{
263
+
message:
264
+
'Use of redundant or invalid role: complementary on <aside> detected. If a landmark element is used, any role provided will either be redundant or incorrect.',
0 commit comments