From a5b9fbd1a1e96f9da9815efad8b05ca33dfd7d47 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Fri, 8 Nov 2024 10:25:24 -0800 Subject: [PATCH] Fix MUI5 menu focus styles. --- src/components/WindowThumbnailSettings.js | 10 +++++++++- src/components/WindowViewSettings.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/WindowThumbnailSettings.js b/src/components/WindowThumbnailSettings.js index 042355e4d..5d05d2549 100644 --- a/src/components/WindowThumbnailSettings.js +++ b/src/components/WindowThumbnailSettings.js @@ -15,7 +15,15 @@ const ThumbnailOption = styled(MenuItem, { name: 'WindowThumbnailSettings', slot borderBottomColor: theme.palette.secondary.main, }), }, - backgroundColor: 'transparent !important', + '&.Mui-selected': { + backgroundColor: 'transparent !important', + }, + '&.Mui-selected.Mui-focusVisible': { + backgroundColor: `${(theme.vars || theme).palette.action.focus} !important`, + }, + '&:focused': { + backgroundColor: `${(theme.vars || theme).palette.action.focus} !important`, + }, color: selected ? theme.palette.secondary.main : undefined, display: 'inline-block', })); diff --git a/src/components/WindowViewSettings.js b/src/components/WindowViewSettings.js index e693b2ffc..d17d0b334 100644 --- a/src/components/WindowViewSettings.js +++ b/src/components/WindowViewSettings.js @@ -16,7 +16,15 @@ const ViewOption = styled(MenuItem, { name: 'WindowViewSettings', slot: 'option' borderBottomColor: theme.palette.secondary.main, }), }, - backgroundColor: 'transparent !important', + '&.Mui-selected': { + backgroundColor: 'transparent !important', + }, + '&.Mui-selected.Mui-focusVisible': { + backgroundColor: `${(theme.vars || theme).palette.action.focus} !important`, + }, + '&:focused': { + backgroundColor: `${(theme.vars || theme).palette.action.focus} !important`, + }, color: selected ? theme.palette.secondary.main : undefined, display: 'inline-block', }));