fix(html): omit aria-hidden when visible
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
9721c23202
commit
4d767fa0bd
2 changed files with 3 additions and 3 deletions
2
node.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue