Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(accessibility) return focus to share file button after upload modal closes (#16312)

Mihaela Dumitrua762d585b885
diff --git a/react/features/file-sharing/components/web/FileSharing.tsx b/react/features/file-sharing/components/web/FileSharing.tsx
index 808965deac..503aa6d93a 100644
--- a/react/features/file-sharing/components/web/FileSharing.tsx
+++ b/react/features/file-sharing/components/web/FileSharing.tsx
@@ -209,6 +209,7 @@ const FileSharing = () => {
const { classes } = useStyles();
const [ isDragging, setIsDragging ] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
+ const uploadButtonRef = useRef<HTMLButtonElement>(null);
const { t } = useTranslation();
const dispatch = useDispatch();
const store = useStore();
@@ -237,7 +238,7 @@ const FileSharing = () => {
if (e.target.files) {
processFiles(e.target.files as FileList, store);
e.target.value = ''; // Reset the input value to allow re-uploading the same file
- e.target.blur(); // Remove focus so Enter/Space won't retrigger
+ uploadButtonRef.current?.focus();
}
}, [ processFiles ]);
@@ -401,6 +402,7 @@ const FileSharing = () => {
labelKey = { 'fileSharing.uploadFile' }
onClick = { handleClick }
onKeyPress = { handleKeyPress }
+ ref = { uploadButtonRef }
type = { BUTTON_TYPES.PRIMARY } />
)
}