fix(html): omit aria-hidden when visible
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-03 17:39:54 +00:00
parent 9721c23202
commit 4d767fa0bd
2 changed files with 3 additions and 3 deletions

View file

@ -220,7 +220,7 @@ func AriaHidden(n Node, hidden bool) Node {
if hidden {
return Attr(n, "aria-hidden", "true")
}
return Attr(n, "aria-hidden", "false")
return n
}
// node.go: TabIndex sets the tabindex attribute on an element node.

View file

@ -303,8 +303,8 @@ func TestAriaHiddenHelper(t *testing.T) {
visible := AriaHidden(El("span", Raw("decorative")), false)
gotVisible := visible.Render(ctx)
if !strings.Contains(gotVisible, `aria-hidden="false"`) {
t.Errorf("AriaHidden(false) = %q, want aria-hidden=\"false\"", gotVisible)
if strings.Contains(gotVisible, `aria-hidden=`) {
t.Errorf("AriaHidden(false) = %q, want no aria-hidden attribute", gotVisible)
}
}