Skip to content

Commit c2a4128

Browse files
committed
docs: address Copilot review wording (PR #32)
1 parent d0844e1 commit c2a4128

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

docs/rules/template-no-autofocus-attribute.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ Examples of **correct** code for this rule:
4040
</template>
4141
```
4242

43-
Explicit opt-out via a falsy value is allowed (parity with
44-
[`jsx-a11y/no-autofocus`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md)):
43+
Explicit opt-out via a mustache boolean `false` is allowed — this is the
44+
only form that statically guarantees no rendered `autofocus` attribute
45+
(Glimmer VM normalizes `{{false}}` to attribute removal). The string
46+
`autofocus="false"` is still flagged per HTML boolean-attribute semantics
47+
(any attribute presence, including the string `"false"`, enables autofocus).
4548

4649
```gjs
4750
<template>
48-
<input autofocus="false" />
4951
<input autofocus={{false}} />
52+
{{!-- element syntax: the mustache-boolean form --}}
5053
</template>
5154
```
5255

lib/rules/template-no-autofocus-attribute.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ function isMustacheBooleanFalse(value) {
3131
}
3232

3333
/**
34-
* Returns true when the given GlimmerElementNode is a `<dialog>` element
35-
* or is nested (at any depth) inside a `<dialog>` element. Per MDN,
34+
* Returns true when the given node (a GlimmerElementNode OR a
35+
* GlimmerMustacheStatement, e.g. `{{input autofocus=true}}`) is a `<dialog>`
36+
* element or is nested (at any depth) inside a `<dialog>` element. Per MDN,
3637
* autofocus on (or within) a dialog is recommended because a dialog should
3738
* focus its initial element when opened.
3839
*

0 commit comments

Comments
 (0)