Skip to content

Commit 3b7b376

Browse files
fix(a11y): address review feedback on accessibility fixes
- Fix malformed transition string in CopyButton and ExternalLink (missing closing brace on last token) - Move aria-invalid into inputProps so it applies to both the default input and any custom renderInput renderer - Clear hasError state on empty-string input path (was only cleared on valid range path, leaving aria-invalid=true after user clears the field) - Add tabIndex={-1} to #main-content so skip link activation moves keyboard focus into the main region
1 parent da58cc0 commit 3b7b376

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/sharedComponents/BigNumberInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const BigNumberInput: FC<BigNumberInputProps> = ({
9393
const { value } = typeof event === 'string' ? { value: event } : event.currentTarget
9494

9595
if (value === '') {
96+
setHasError(false)
9697
onChange(BigInt(0))
9798
return
9899
}
@@ -136,6 +137,7 @@ export const BigNumberInput: FC<BigNumberInputProps> = ({
136137
}
137138

138139
const inputProps = {
140+
'aria-invalid': (hasError || undefined) as true | undefined,
139141
disabled,
140142
onChange: updateValue,
141143
placeholder,
@@ -146,7 +148,6 @@ export const BigNumberInput: FC<BigNumberInputProps> = ({
146148
renderInput({ ...inputProps, inputRef })
147149
) : (
148150
<chakra.input
149-
aria-invalid={hasError || undefined}
150151
{...inputProps}
151152
ref={inputRef}
152153
/>

src/components/sharedComponents/ui/CopyButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const CopyButton: FC<Props> = ({
8585
borderRadius: '2px',
8686
}}
8787
textDecoration="none"
88-
transition="background-color {durations.moderate}, border-color {durations.moderate}, color {durations.moderate"
88+
transition="background-color {durations.moderate}, border-color {durations.moderate}, color {durations.moderate}"
8989
userSelect="none"
9090
whiteSpace="nowrap"
9191
width="fit-content"

src/components/sharedComponents/ui/ExternalLink/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ExternalLinkButton: FC<LinkProps> = ({
6464
outlineOffset: '2px',
6565
borderRadius: '2px',
6666
}}
67-
transition="background-color {durations.moderate}, border-color {durations.moderate}, color {durations.moderate"
67+
transition="background-color {durations.moderate}, border-color {durations.moderate}, color {durations.moderate}"
6868
whiteSpace="nowrap"
6969
width="fit-content"
7070
_hover={{

src/routes/__root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function Root() {
4949
direction="column"
5050
flexGrow="1"
5151
id="main-content"
52+
tabIndex={-1}
5253
>
5354
<Outlet />
5455
</Flex>

0 commit comments

Comments
 (0)