From 5486047ee11aa4a95fae69805755023b17f65415 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:26:54 -0400 Subject: [PATCH 1/3] Extract rule: template-no-down-event-binding --- README.md | 1 + docs/rules/template-no-down-event-binding.md | 78 +++++++++++++++++++ lib/rules/template-no-down-event-binding.js | 57 ++++++++++++++ .../rules/template-no-down-event-binding.js | 71 +++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 docs/rules/template-no-down-event-binding.md create mode 100644 lib/rules/template-no-down-event-binding.js create mode 100644 tests/lib/rules/template-no-down-event-binding.js diff --git a/README.md b/README.md index fa039687d7..b0ee160a3d 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ rules in templates can be disabled with eslint directives with mustache or html | [template-no-aria-hidden-body](docs/rules/template-no-aria-hidden-body.md) | disallow aria-hidden on body element | | 🔧 | | | [template-no-aria-unsupported-elements](docs/rules/template-no-aria-unsupported-elements.md) | disallow ARIA roles, states, and properties on elements that do not support them | | | | | [template-no-autofocus-attribute](docs/rules/template-no-autofocus-attribute.md) | disallow autofocus attribute | | 🔧 | | +| [template-no-down-event-binding](docs/rules/template-no-down-event-binding.md) | disallow mouse down event bindings | | | | | [template-no-empty-headings](docs/rules/template-no-empty-headings.md) | disallow empty heading elements | | | | | [template-no-heading-inside-button](docs/rules/template-no-heading-inside-button.md) | disallow heading elements inside button elements | | | | | [template-no-invalid-aria-attributes](docs/rules/template-no-invalid-aria-attributes.md) | disallow invalid aria-* attributes | | | | diff --git a/docs/rules/template-no-down-event-binding.md b/docs/rules/template-no-down-event-binding.md new file mode 100644 index 0000000000..097fa946c7 --- /dev/null +++ b/docs/rules/template-no-down-event-binding.md @@ -0,0 +1,78 @@ +# ember/template-no-down-event-binding + + + +Disallows mouse down and touch start event bindings. + +Mouse down and touch start events can cause accessibility issues because they don't work well with keyboard navigation. Use `click` or `keydown` events instead. + +## Rule Details + +This rule disallows the use of `mousedown` and `touchstart` events in templates. + +## Examples + +Examples of **incorrect** code for this rule: + +```gjs + +``` + +```gjs + +``` + +```gjs + +``` + +Examples of **correct** code for this rule: + +```gjs + +``` + +```gjs + +``` + +```gjs + +``` + +## Migration + +Replace: + +```gjs +