Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Another ARIA workaround

Manav Rathia851caf78fb9
diff --git a/web/packages/base/components/utils/theme.ts b/web/packages/base/components/utils/theme.ts
index 1e511b4ac7..1106644235 100644
--- a/web/packages/base/components/utils/theme.ts
+++ b/web/packages/base/components/utils/theme.ts
@@ -541,6 +541,8 @@ const components: Components = {
MuiDialog: {
defaultProps: {
+ // [Note: Overjealous Chrome? Complicated ARIA?]
+ //
// This is required to prevent console errors about aria-hiding a
// focused button when the dialog is closed.
//
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index b22fb97a99..5357653e87 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -18,7 +18,10 @@ import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { SidebarDrawer } from "@/base/components/mui/SidebarDrawer";
import { Titlebar } from "@/base/components/Titlebar";
import { EllipsizedTypography } from "@/base/components/Typography";
-import { useModalVisibility, type ModalVisibilityProps } from "@/base/components/utils/modal";
+import {
+ useModalVisibility,
+ type ModalVisibilityProps,
+} from "@/base/components/utils/modal";
import { useBaseContext } from "@/base/context";
import { haveWindow } from "@/base/env";
import { nameAndExtension } from "@/base/file-name";
@@ -136,7 +139,7 @@ export type FileInfoProps = ModalVisibilityProps & {
* Called when the user selects a person in the file info panel.
*/
onSelectPerson?: ((personID: string) => void) | undefined;
-}
+};
export const FileInfo: React.FC<FileInfoProps> = ({
open,
@@ -398,7 +401,16 @@ const parseExifInfo = (
const FileInfoSidebar = styled(
(props: Pick<DialogProps, "open" | "onClose" | "children">) => (
- <SidebarDrawer {...props} anchor="right" />
+ <SidebarDrawer
+ {...props}
+ anchor="right"
+ // See: [Note: Overjealous Chrome? Complicated ARIA?], but this time
+ // with a different workaround.
+ //
+ // https://github.com/mui/material-ui/issues/43106#issuecomment-2514637251
+ disableRestoreFocus={true}
+ closeAfterTransition={true}
+ />
),
)(({ theme }) => ({
zIndex: fileInfoDrawerZ,
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 31a198ec38..2951386288 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -198,6 +198,9 @@ export class FileViewerPhotoSwipe {
// Chrome yells about incorrectly mixing focus and aria-hidden if we
// leave this at the default (true) and then swipe between slides
// fast, or show MUI drawers etc.
+ //
+ // See: [Note: Overjealous Chrome? Complicated ARIA?], but time with
+ // a different library.
trapFocus: false,
// Set the index within files that we should open to. Subsequent
// updates to the index will be tracked by PhotoSwipe internally.