Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip adding DomUtils.getAutofilledInputStyle for static ThemeProvider #53057

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ function ThemeProvider({children, theme: staticThemePreference}: ThemeProviderPr
const theme = useMemo(() => themes[debouncedTheme], [debouncedTheme]);

useEffect(() => {
/*
* For static themes we don't want to apply the autofill input style globally
* SignInPageLayout uses static theme and handles this differently.
*/
if (staticThemePreference) {
return;
}
DomUtils.addCSS(DomUtils.getAutofilledInputStyle(theme.text), 'autofill-input');

// staticThemePreference as it is a property that does not change we don't need it in the dependency array
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [theme.text]);

return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
Expand Down