GrafanaUI: Remove blurred background from overlay backdrops to improve performance (#103563)

* default noBackdropBlur to enabled

* move blur from hacks to theme.components, tweak backdrop colour

* remove toggle completely

* fix unused import
pull/103598/head
Josh Hunt 3 months ago committed by GitHub
parent 7a1f1faca3
commit 577ea8f6a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      packages/grafana-data/src/themes/createComponents.ts
  2. 4
      packages/grafana-data/src/types/featureToggles.gen.ts
  3. 1
      packages/grafana-ui/src/components/Carousel/Carousel.tsx
  4. 1
      packages/grafana-ui/src/components/Drawer/Drawer.tsx
  5. 1
      packages/grafana-ui/src/components/Modal/getModalStyles.ts
  6. 5
      packages/grafana-ui/src/themes/GlobalStyles/GlobalStyles.tsx
  7. 19
      packages/grafana-ui/src/themes/GlobalStyles/hacks.ts
  8. 9
      pkg/services/featuremgmt/registry.go
  9. 1
      pkg/services/featuremgmt/toggles_gen.csv
  10. 4
      pkg/services/featuremgmt/toggles_gen.go
  11. 15
      pkg/services/featuremgmt/toggles_gen.json
  12. 1
      public/app/core/components/AppChrome/AppChromeMenu.tsx
  13. 3
      public/app/core/components/AppChrome/ExtensionSidebar/GlobalStylesWrapper.tsx
  14. 1
      public/app/features/commandPalette/CommandPalette.tsx
  15. 3
      public/app/routes/RoutesWrapper.tsx

@ -31,6 +31,9 @@ export interface ThemeComponents {
}; };
overlay: { overlay: {
background: string; background: string;
/* pixel strength for backdrop blurs */
blur?: number;
}; };
dashboard: { dashboard: {
background: string; background: string;
@ -88,7 +91,7 @@ export function createComponents(colors: ThemeColors, shadows: ThemeShadows): Th
padding: 1, padding: 1,
}, },
overlay: { overlay: {
background: colors.mode === 'dark' ? 'rgba(63, 62, 62, 0.45)' : 'rgba(208, 209, 211, 0.24)', background: colors.mode === 'dark' ? 'rgba(63, 62, 62, 0.5)' : 'rgba(208, 209, 211, 0.5)',
}, },
sidemenu: { sidemenu: {
width: 57, width: 57,

@ -1001,10 +1001,6 @@ export interface FeatureToggles {
*/ */
inviteUserExperimental?: boolean; inviteUserExperimental?: boolean;
/** /**
* Disables backdrop blur
*/
noBackdropBlur?: boolean;
/**
* Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules * Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules
*/ */
alertingMigrationUI?: boolean; alertingMigrationUI?: boolean;

@ -178,7 +178,6 @@ const getStyles = () => (theme: GrafanaTheme2) => ({
bottom: 0, bottom: 0,
left: 0, left: 0,
backgroundColor: theme.components.overlay.background, backgroundColor: theme.components.overlay.background,
backdropFilter: 'blur(1px)',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
display: 'flex', display: 'flex',

@ -292,7 +292,6 @@ const getStyles = (theme: GrafanaTheme2) => {
'&:before': { '&:before': {
backgroundColor: `${theme.components.overlay.background} !important`, backgroundColor: `${theme.components.overlay.background} !important`,
backdropFilter: 'blur(1px)',
bottom: 0, bottom: 0,
content: '""', content: '""',
left: 0, left: 0,

@ -34,7 +34,6 @@ export const getModalStyles = (theme: GrafanaTheme2) => {
bottom: 0, bottom: 0,
left: 0, left: 0,
backgroundColor: theme.components.overlay.background, backgroundColor: theme.components.overlay.background,
backdropFilter: 'blur(1px)',
}), }),
modalHeader: css({ modalHeader: css({
label: 'modalHeader', label: 'modalHeader',

@ -25,14 +25,13 @@ import { getUplotStyles } from './uPlot';
import { getUtilityClassStyles } from './utilityClasses'; import { getUtilityClassStyles } from './utilityClasses';
interface GlobalStylesProps { interface GlobalStylesProps {
hackNoBackdropBlur?: boolean;
isExtensionSidebarOpen?: boolean; isExtensionSidebarOpen?: boolean;
} }
/** @internal */ /** @internal */
export function GlobalStyles(props: GlobalStylesProps) { export function GlobalStyles(props: GlobalStylesProps) {
const theme = useTheme2(); const theme = useTheme2();
const { hackNoBackdropBlur, isExtensionSidebarOpen } = props; const { isExtensionSidebarOpen } = props;
return ( return (
<Global <Global
@ -57,7 +56,7 @@ export function GlobalStyles(props: GlobalStylesProps) {
getUplotStyles(theme), getUplotStyles(theme),
getUtilityClassStyles(theme), getUtilityClassStyles(theme),
getLegacySelectStyles(theme), getLegacySelectStyles(theme),
getHacksStyles({ hackNoBackdropBlur }), getHacksStyles({}),
]} ]}
/> />
); );

@ -1,21 +1,8 @@
import { css } from '@emotion/react'; import { css } from '@emotion/react';
export interface Hacks { export interface Hacks {}
hackNoBackdropBlur?: boolean;
}
export function getHacksStyles(hacks: Hacks) { export function getHacksStyles(hacks: Hacks) {
return css([ // No hacks for now! Look how good we are!
/** return css([]);
* Disables all backdrop blur effects to improve performance on extremely
* resource constrained devices.
*
* Controlled via the `noBackdropBlur` feature toggle in Grafana
*/
hacks.hackNoBackdropBlur && {
'*, *:before, *:after': {
backdropFilter: 'none !important',
},
},
]);
} }

@ -1712,15 +1712,6 @@ var (
HideFromDocs: true, HideFromDocs: true,
FrontendOnly: true, FrontendOnly: true,
}, },
{
Name: "noBackdropBlur",
Description: "Disables backdrop blur",
Stage: FeatureStageExperimental,
Owner: grafanaFrontendPlatformSquad,
HideFromAdminPage: true,
HideFromDocs: true,
FrontendOnly: true,
},
{ {
Name: "alertingMigrationUI", Name: "alertingMigrationUI",
Description: "Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules", Description: "Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules",

@ -225,7 +225,6 @@ alertRuleRestore,preview,@grafana/alerting-squad,false,false,false
grafanaManagedRecordingRulesDatasources,experimental,@grafana/alerting-squad,false,false,false grafanaManagedRecordingRulesDatasources,experimental,@grafana/alerting-squad,false,false,false
infinityRunQueriesInParallel,privatePreview,@grafana/oss-big-tent,false,false,false infinityRunQueriesInParallel,privatePreview,@grafana/oss-big-tent,false,false,false
inviteUserExperimental,experimental,@grafana/sharing-squad,false,false,true inviteUserExperimental,experimental,@grafana/sharing-squad,false,false,true
noBackdropBlur,experimental,@grafana/grafana-frontend-platform,false,false,true
alertingMigrationUI,experimental,@grafana/alerting-squad,false,false,true alertingMigrationUI,experimental,@grafana/alerting-squad,false,false,true
unifiedStorageHistoryPruner,experimental,@grafana/search-and-storage,false,false,false unifiedStorageHistoryPruner,experimental,@grafana/search-and-storage,false,false,false
azureMonitorLogsBuilderEditor,preview,@grafana/partner-datasources,false,false,false azureMonitorLogsBuilderEditor,preview,@grafana/partner-datasources,false,false,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
225 grafanaManagedRecordingRulesDatasources experimental @grafana/alerting-squad false false false
226 infinityRunQueriesInParallel privatePreview @grafana/oss-big-tent false false false
227 inviteUserExperimental experimental @grafana/sharing-squad false false true
noBackdropBlur experimental @grafana/grafana-frontend-platform false false true
228 alertingMigrationUI experimental @grafana/alerting-squad false false true
229 unifiedStorageHistoryPruner experimental @grafana/search-and-storage false false false
230 azureMonitorLogsBuilderEditor preview @grafana/partner-datasources false false false

@ -911,10 +911,6 @@ const (
// Renders invite user button along the app // Renders invite user button along the app
FlagInviteUserExperimental = "inviteUserExperimental" FlagInviteUserExperimental = "inviteUserExperimental"
// FlagNoBackdropBlur
// Disables backdrop blur
FlagNoBackdropBlur = "noBackdropBlur"
// FlagAlertingMigrationUI // FlagAlertingMigrationUI
// Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules // Enables the alerting migration UI, to migrate datasource-managed rules to Grafana-managed rules
FlagAlertingMigrationUI = "alertingMigrationUI" FlagAlertingMigrationUI = "alertingMigrationUI"

@ -2177,16 +2177,19 @@
{ {
"metadata": { "metadata": {
"name": "noBackdropBlur", "name": "noBackdropBlur",
"resourceVersion": "1743693517832", "resourceVersion": "1744057771109",
"creationTimestamp": "2025-04-03T15:18:37Z" "creationTimestamp": "2025-04-03T15:18:37Z",
"deletionTimestamp": "2025-04-08T09:27:30Z",
"annotations": {
"grafana.app/updatedTimestamp": "2025-04-07 20:29:31.109804663 +0000 UTC"
}
}, },
"spec": { "spec": {
"description": "Disables backdrop blur", "description": "Disables backdrop blur behind modals and drawers",
"stage": "experimental", "stage": "GA",
"codeowner": "@grafana/grafana-frontend-platform", "codeowner": "@grafana/grafana-frontend-platform",
"frontend": true, "frontend": true,
"hideFromAdminPage": true, "expression": "true"
"hideFromDocs": true
} }
}, },
{ {

@ -81,7 +81,6 @@ export function AppChromeMenu({}: Props) {
const getStyles = (theme: GrafanaTheme2) => { const getStyles = (theme: GrafanaTheme2) => {
return { return {
backdrop: css({ backdrop: css({
backdropFilter: 'blur(1px)',
backgroundColor: theme.components.overlay.background, backgroundColor: theme.components.overlay.background,
bottom: 0, bottom: 0,
left: 0, left: 0,

@ -1,4 +1,3 @@
import { config } from '@grafana/runtime';
import { GlobalStyles } from '@grafana/ui'; import { GlobalStyles } from '@grafana/ui';
import { useExtensionSidebarContext } from './ExtensionSidebarProvider'; import { useExtensionSidebarContext } from './ExtensionSidebarProvider';
@ -10,5 +9,5 @@ import { useExtensionSidebarContext } from './ExtensionSidebarProvider';
export const GlobalStylesWrapper = () => { export const GlobalStylesWrapper = () => {
const { isOpen } = useExtensionSidebarContext(); const { isOpen } = useExtensionSidebarContext();
return <GlobalStyles hackNoBackdropBlur={config.featureToggles.noBackdropBlur} isExtensionSidebarOpen={isOpen} />; return <GlobalStyles isExtensionSidebarOpen={isOpen} />;
}; };

@ -174,7 +174,6 @@ const getSearchStyles = (theme: GrafanaTheme2, lateralSpace: number) => {
bottom: 0, bottom: 0,
left: 0, left: 0,
background: theme.components.overlay.background, background: theme.components.overlay.background,
backdropFilter: 'blur(1px)',
}, },
}), }),
animator: css({ animator: css({

@ -6,7 +6,6 @@ import { CompatRouter } from 'react-router-dom-v5-compat';
import { GrafanaTheme2 } from '@grafana/data'; import { GrafanaTheme2 } from '@grafana/data';
import { import {
config,
locationService, locationService,
LocationServiceProvider, LocationServiceProvider,
useChromeHeaderHeight, useChromeHeaderHeight,
@ -113,7 +112,7 @@ export function ExperimentalSplitPaneRouterWrapper(props: RouterWrapperProps) {
<Router history={locationService.getHistory()}> <Router history={locationService.getHistory()}>
<LocationServiceProvider service={locationService}> <LocationServiceProvider service={locationService}>
<CompatRouter> <CompatRouter>
<GlobalStyles hackNoBackdropBlur={config.featureToggles.noBackdropBlur} /> <GlobalStyles />
<div className={styles.secondAppChrome}> <div className={styles.secondAppChrome}>
<div className={styles.secondAppToolbar}> <div className={styles.secondAppToolbar}>
<IconButton <IconButton

Loading…
Cancel
Save