@@ -27,6 +27,26 @@ function isAriaHiddenTrue(attr) {
2727 return resolved . trim ( ) . toLowerCase ( ) === 'true' ;
2828}
2929
30+ // True if the HTML boolean `hidden` attribute renders as present at runtime.
31+ // Per docs/glimmer-attribute-behavior.md, only bare-mustache boolean-false
32+ // (`hidden={{false}}`) is omitted at runtime. Concat (`hidden="{{false}}"`)
33+ // and string-literal (`hidden={{"false"}}`) forms keep the attribute present
34+ // (and HTML treats any presence — including value "false" — as ON).
35+ function rendersHidden ( attr ) {
36+ if ( ! attr ) {
37+ return false ;
38+ }
39+ const v = attr . value ;
40+ if (
41+ v ?. type === 'GlimmerMustacheStatement' &&
42+ v . path ?. type === 'GlimmerBooleanLiteral' &&
43+ v . path . value === false
44+ ) {
45+ return false ;
46+ }
47+ return true ;
48+ }
49+
3050// True if the anchor itself declares an accessible name via a statically
3151// non-empty `aria-label`, `aria-labelledby`, or `title`, OR via a dynamic
3252// value (we can't know at lint time whether a mustache resolves to an empty
@@ -105,7 +125,7 @@ function evaluateChild(child, sourceCode) {
105125 // from the accessibility tree — equivalent to aria-hidden="true" for
106126 // accessible-name purposes. A <span hidden>Backup</span> inside an
107127 // anchor contributes no name at runtime.
108- if ( attrs . some ( ( a ) => a . name === 'hidden' ) ) {
128+ if ( rendersHidden ( attrs . find ( ( a ) => a . name === 'hidden' ) ) ) {
109129 return { dynamic : false , accessible : false } ;
110130 }
111131
@@ -216,8 +236,7 @@ module.exports = {
216236 // `hidden` boolean attribute (element is not rendered at all) or
217237 // `aria-hidden="true"` (element removed from the accessibility tree).
218238 // In both cases, "accessible name of an anchor" is moot.
219- const hasHidden = attrs . some ( ( a ) => a . name === 'hidden' ) ;
220- if ( hasHidden ) {
239+ if ( rendersHidden ( attrs . find ( ( a ) => a . name === 'hidden' ) ) ) {
221240 return ;
222241 }
223242 const ariaHiddenAttr = attrs . find ( ( a ) => a . name === 'aria-hidden' ) ;
0 commit comments