Skip to content

Commit

Permalink
Set aria-hidden="true" when type is label (#1247)
Browse files Browse the repository at this point in the history
* add aria-hidden when type is label

* Create eighty-hounds-cheer.md
  • Loading branch information
khiga8 authored Jul 30, 2022
1 parent 3facfce commit dbe606b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-hounds-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Set `aria-hidden="true"` when type is label
2 changes: 1 addition & 1 deletion app/assets/javascripts/primer_view_components.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/primer_view_components.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/components/primer/alpha/tool-tip-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class ToolTipElement extends HTMLElement {
if (!this.id || !this.control) return
if (this.type === 'label') {
this.control.setAttribute('aria-labelledby', this.id)
this.setAttribute('aria-hidden', 'true')
} else {
let describedBy = this.control.getAttribute('aria-describedby')
describedBy ? (describedBy = `${describedBy} ${this.id}`) : (describedBy = this.id)
Expand Down

0 comments on commit dbe606b

Please sign in to comment.