Skip to content

Commit

Permalink
fix(FileUploader): hide native input in Safari (#3309)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackUait committed Nov 2, 2023
1 parent d881c90 commit 3454e50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions packages/react-ui/components/FileUploader/FileUploader.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ const styles = {
`;
},

fileInput() {
visuallyHidden() {
return css`
width: 0;
height: 0;
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
`;
},

Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/FileUploader/FileUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ const _FileUploader = React.forwardRef<FileUploaderRef, _FileUploaderProps>((pro
type="file"
disabled={disabled}
multiple={multiple}
className={jsStyles.fileInput()}
className={jsStyles.visuallyHidden()}
onClick={stopPropagation}
onChange={handleInputChange}
onFocus={handleFocus}
Expand Down

0 comments on commit 3454e50

Please sign in to comment.