From e25d3ddfb0ad261fd2b3dc8ada63325558391146 Mon Sep 17 00:00:00 2001 From: uncommon-type Date: Wed, 16 Mar 2022 11:12:16 +0300 Subject: [PATCH] [Docs] `no-static-element-interactions`: Update error message - 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..737c11a58 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, add an appropriate role and support for tabbing, mouse, keyboard and touch inputs to an interactive content element.'; const expectedError = { message: errorMessage, diff --git a/src/rules/no-static-element-interactions.js b/src/rules/no-static-element-interactions.js index 8348f1578..ba6671172 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, add an appropriate role and support for tabbing, mouse, keyboard, and touch inputs to an interactive content element.'; const domElements = [...dom.keys()]; const defaultInteractiveProps = [