From 4d767fa0bdf4c1410a0a5f7703d6d7e5af0cbe6b Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 17:39:54 +0000 Subject: [PATCH] fix(html): omit aria-hidden when visible Co-Authored-By: Virgil --- node.go | 2 +- node_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node.go b/node.go index 2d4aefa..0f2991e 100644 --- a/node.go +++ b/node.go @@ -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. diff --git a/node_test.go b/node_test.go index b2a630b..37aa206 100644 --- a/node_test.go +++ b/node_test.go @@ -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) } }