Skip to content

Commit 47b7ea0

Browse files
Remove aria-hidden=true from spans with required asterisk (#3320)
* Remove aria-hidden=true from spans with required asterisk * Create pink-beds-fetch.md --------- Co-authored-by: Cole Bemis <[email protected]>
1 parent a71bb60 commit 47b7ea0

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/pink-beds-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Remove `aria-hidden=true` from `span`s with required asterisk

src/_InputLabel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const InputLabel: React.FC<React.PropsWithChildren<Props>> = ({
5555
{required ? (
5656
<Box display="flex" as="span">
5757
<Box mr={1}>{children}</Box>
58-
<span aria-hidden="true">*</span>
58+
<span>*</span>
5959
</Box>
6060
) : (
6161
children

src/__tests__/deprecated/InputField.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import InputField from '../../deprecated/InputField'
66
expect.extend(toHaveNoViolations)
77

88
const TEXTINPUTFIELD_LABEL_TEXT = 'Name'
9+
const TEXTINPUTFIELD_LABEL_TEXT_WITH_ASTERISK = 'Name *'
910
const TEXTINPUTFIELD_CAPTION_TEXT = 'Hint: your first name'
1011
const TEXTINPUTFIELD_SUCCESS_TEXT = 'This name is valid'
1112
const TEXTINPUTFIELD_ERROR_TEXT = 'This name is invalid'
@@ -66,7 +67,7 @@ describe('InputField', () => {
6667
</SSRProvider>,
6768
)
6869

69-
const input = getByRole('textbox', {name: TEXTINPUTFIELD_LABEL_TEXT})
70+
const input = getByRole('textbox', {name: TEXTINPUTFIELD_LABEL_TEXT_WITH_ASTERISK})
7071

7172
expect(input.getAttribute('required')).not.toBeNull()
7273
})

0 commit comments

Comments
 (0)