From 16d5953c1bbe47a2826ea822b726f3ad124ec22b Mon Sep 17 00:00:00 2001 From: uncommon-type Date: Wed, 16 Mar 2022 11:12:16 +0300 Subject: [PATCH] [Docs] Update error message for no-static-element-interactions rule - Recommend using native HTML whenever possible - If using native counterpart is impossible, recommend adding to all interactive non-semantic elements an appropriate role along with support for mouse, keyboard and touch inputs. Fixes #761 --- __tests__/src/rules/no-static-element-interactions-test.js | 2 +- src/rules/no-static-element-interactions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/src/rules/no-static-element-interactions-test.js b/__tests__/src/rules/no-static-element-interactions-test.js index 329c79f35..6a37068e4 100644 --- a/__tests__/src/rules/no-static-element-interactions-test.js +++ b/__tests__/src/rules/no-static-element-interactions-test.js @@ -19,7 +19,7 @@ import ruleOptionsMapperFactory from '../../__util__/ruleOptionsMapperFactory'; const ruleTester = new RuleTester(); -const errorMessage = 'Static HTML elements with event handlers require a role.'; +const errorMessage = 'Avoid non-native interactive elements. If using native HTML is not possible, an interactive content element needs an appropriate role and support for tabbing, mouse, keyboard and touch inputs.'; const expectedError = { message: errorMessage, diff --git a/src/rules/no-static-element-interactions.js b/src/rules/no-static-element-interactions.js index 8348f1578..994f72faf 100644 --- a/src/rules/no-static-element-interactions.js +++ b/src/rules/no-static-element-interactions.js @@ -29,7 +29,7 @@ import isNonInteractiveRole from '../util/isNonInteractiveRole'; import isNonLiteralProperty from '../util/isNonLiteralProperty'; import isPresentationRole from '../util/isPresentationRole'; -const errorMessage = 'Static HTML elements with event handlers require a role.'; +const errorMessage = 'Avoid non-native interactive elements. If using native HTML is not possible, an interactive content element needs an appropriate role and support for tabbing, mouse, keyboard and touch inputs.'; const domElements = [...dom.keys()]; const defaultInteractiveProps = [