Skip to content

Commit

Permalink
[button][material-ui] Fix 'File upload' demo a11y (#40943)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Feb 11, 2024
1 parent af72a04 commit e3b6520
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docs/data/material/components/buttons/InputFileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ const VisuallyHiddenInput = styled('input')({

export default function InputFileUpload() {
return (
<Button component="label" variant="contained" startIcon={<CloudUploadIcon />}>
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
>
Upload file
<VisuallyHiddenInput type="file" />
</Button>
Expand Down
8 changes: 7 additions & 1 deletion docs/data/material/components/buttons/InputFileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ const VisuallyHiddenInput = styled('input')({

export default function InputFileUpload() {
return (
<Button component="label" variant="contained" startIcon={<CloudUploadIcon />}>
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
>
Upload file
<VisuallyHiddenInput type="file" />
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<Button component="label" variant="contained" startIcon={<CloudUploadIcon />}>
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
>
Upload file
<VisuallyHiddenInput type="file" />
</Button>

0 comments on commit e3b6520

Please sign in to comment.