Skip to content

Commit

Permalink
Modify error message, fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
uncommon-type committed Mar 16, 2022
1 parent 9dc1fe5 commit 0d6a96c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/src/rules/no-static-element-interactions-test.js
Expand Up @@ -19,7 +19,7 @@ import ruleOptionsMapperFactory from '../../__util__/ruleOptionsMapperFactory';

const ruleTester = new RuleTester();

const errorMessage = 'The best replacement for an interactive static element is the corresponding semantic HTML element. 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 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,
Expand Down
18 changes: 9 additions & 9 deletions src/rules/no-static-element-interactions.js
Expand Up @@ -29,7 +29,7 @@ import isNonInteractiveRole from '../util/isNonInteractiveRole';
import isNonLiteralProperty from '../util/isNonLiteralProperty';
import isPresentationRole from '../util/isPresentationRole';

const errorMessage = 'The best replacement for an interactive static element is the corresponding semantic HTML element. 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 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 = [
Expand Down Expand Up @@ -65,7 +65,7 @@ export default ({
const hasInteractiveProps = handlers
.some((prop) => (
hasProp(attributes, prop)
&& getPropValue(getProp(attributes, prop)) != null
&& getPropValue(getProp(attributes, prop)) != null
));

if (!includes(domElements, type)) {
Expand All @@ -75,8 +75,8 @@ export default ({
}
if (
!hasInteractiveProps
|| isHiddenFromScreenReader(type, attributes)
|| isPresentationRole(type, attributes)
|| isHiddenFromScreenReader(type, attributes)
|| isPresentationRole(type, attributes)
) {
// Presentation is an intentional signal from the author that this
// element is not meant to be perceivable. For example, a click screen
Expand All @@ -85,18 +85,18 @@ export default ({
}
if (
isInteractiveElement(type, attributes)
|| isInteractiveRole(type, attributes)
|| isNonInteractiveElement(type, attributes)
|| isNonInteractiveRole(type, attributes)
|| isAbstractRole(type, attributes)
|| isInteractiveRole(type, attributes)
|| isNonInteractiveElement(type, attributes)
|| isNonInteractiveRole(type, attributes)
|| isAbstractRole(type, attributes)
) {
// This rule has no opinion about abstract roles.
return;
}

if (
allowExpressionValues === true
&& isNonLiteralProperty(attributes, 'role')
&& isNonLiteralProperty(attributes, 'role')
) {
// This rule has no opinion about non-literal roles.
return;
Expand Down

0 comments on commit 0d6a96c

Please sign in to comment.