diff --git a/src/compiler/compile/compiler_warnings.ts b/src/compiler/compile/compiler_warnings.ts index 5fc5faa8f1..b1981e0494 100644 --- a/src/compiler/compile/compiler_warnings.ts +++ b/src/compiler/compile/compiler_warnings.ts @@ -179,6 +179,10 @@ export default { code: 'a11y-missing-content', message: `A11y: <${name}> element should have child content` }), + a11y_no_nointeractive_tabindex: { + code: 'a11y-no-nointeractive-tabindex', + message: 'A11y: not interactive element cannot have positive tabIndex value' + }, redundant_event_modifier_for_touch: { code: 'redundant-event-modifier', message: 'Touch event handlers that don\'t use the \'event\' object are passive by default' diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 3fc9f73a31..7986a37e94 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -561,10 +561,7 @@ export default class Element extends Node { if (_tabIndexValue) { const tabIndexValue = Number(_tabIndexValue.get_static_value()); if (!isNaN(tabIndexValue) && tabIndexValue >= 0) { - component.warn(this, { - code: 'a11y-no-nointeractive-tabindex', - message: 'A11y: not interactive element cannot have positive tabIndex value' - }); + component.warn(this, compiler_warnings.a11y_no_nointeractive_tabindex); } } }