diff --git a/apps/browser/src/autofill/notification/bar.ts b/apps/browser/src/autofill/notification/bar.ts
index 285ae4aa257..a83e9fce531 100644
--- a/apps/browser/src/autofill/notification/bar.ts
+++ b/apps/browser/src/autofill/notification/bar.ts
@@ -12,7 +12,7 @@ import { NotificationConfirmationContainer } from "../content/components/notific
import { NotificationContainer } from "../content/components/notification/container";
import { selectedFolder as selectedFolderSignal } from "../content/components/signals/selected-folder";
import { selectedVault as selectedVaultSignal } from "../content/components/signals/selected-vault";
-import { buildSvgDomElement } from "../utils";
+import { buildSvgDomElement, matchAllowedColorSchemes } from "../utils";
import { circleCheckIcon } from "../utils/svg-icons";
import {
@@ -238,6 +238,15 @@ async function initNotificationBar(message: NotificationBarWindowMessage) {
const i18n = getI18n();
const resolvedTheme = getResolvedTheme(theme ?? ThemeTypes.Light);
+ // https://drafts.csswg.org/css-color-adjust-1/#preferred
+ // Prevents preferred color scheme from forcing an opaque background in the iframe
+ const colorScheme = new URLSearchParams(window.location.search).get("colorScheme") || "";
+ const allowedColorScheme = matchAllowedColorSchemes(colorScheme);
+ const meta = document.createElement("meta");
+ meta.setAttribute("name", "color-scheme");
+ meta.setAttribute("content", allowedColorScheme);
+ document.getElementsByTagName("head")[0].appendChild(meta);
+
if (useComponentBar) {
const resolvedType = resolveNotificationType(notificationBarIframeInitData);
const headerMessage = getNotificationHeaderMessage(i18n, resolvedType);
diff --git a/apps/browser/src/autofill/overlay/notifications/content/__snapshots__/overlay-notifications-content.service.spec.ts.snap b/apps/browser/src/autofill/overlay/notifications/content/__snapshots__/overlay-notifications-content.service.spec.ts.snap
index c20626212fa..1b5d9a73888 100644
--- a/apps/browser/src/autofill/overlay/notifications/content/__snapshots__/overlay-notifications-content.service.spec.ts.snap
+++ b/apps/browser/src/autofill/overlay/notifications/content/__snapshots__/overlay-notifications-content.service.spec.ts.snap
@@ -7,7 +7,7 @@ exports[`OverlayNotificationsContentService opening the notification bar creates
>
diff --git a/apps/browser/src/autofill/overlay/notifications/content/overlay-notifications-content.service.ts b/apps/browser/src/autofill/overlay/notifications/content/overlay-notifications-content.service.ts
index 95f4d297b31..ee005852a42 100644
--- a/apps/browser/src/autofill/overlay/notifications/content/overlay-notifications-content.service.ts
+++ b/apps/browser/src/autofill/overlay/notifications/content/overlay-notifications-content.service.ts
@@ -7,7 +7,7 @@ import {
NotificationType,
NotificationTypes,
} from "../../../notification/abstractions/notification-bar";
-import { sendExtensionMessage, setElementStyles } from "../../../utils";
+import { matchAllowedColorSchemes, sendExtensionMessage, setElementStyles } from "../../../utils";
import {
NotificationsExtensionMessage,
OverlayNotificationsContentService as OverlayNotificationsContentServiceInterface,
@@ -175,13 +175,18 @@ export class OverlayNotificationsContentService
* @param initData - The initialization data for the notification bar.
*/
private createNotificationBarIframeElement(initData: NotificationBarIframeInitData) {
+ const content = (document.querySelector('meta[name="color-scheme"]') as HTMLMetaElement)
+ ?.content;
+ const allowedColorScheme = matchAllowedColorSchemes(content);
const isNotificationFresh =
initData.launchTimestamp && Date.now() - initData.launchTimestamp < 250;
this.currentNotificationBarType = initData.type;
this.notificationBarIframeElement = globalThis.document.createElement("iframe");
this.notificationBarIframeElement.id = "bit-notification-bar-iframe";
- this.notificationBarIframeElement.src = chrome.runtime.getURL("notification/bar.html");
+ this.notificationBarIframeElement.src = chrome.runtime.getURL(
+ `notification/bar.html?colorScheme=${encodeURIComponent(allowedColorScheme)}`,
+ );
setElementStyles(
this.notificationBarIframeElement,
{
diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts
index 614a5b014f2..97539673abc 100644
--- a/apps/browser/src/autofill/utils/index.ts
+++ b/apps/browser/src/autofill/utils/index.ts
@@ -575,3 +575,22 @@ export function areKeyValuesNull>(
return keysToCheck.every((key) => obj[key] == null);
}
+
+export type AllowedColorScheme = "light dark" | "dark light" | "light" | "dark" | "normal";
+
+/**
+ * Ensures string matches allowed color scheme, defaulting/overriding to "normal".
+ * https://drafts.csswg.org/css-color-adjust-1/#color-scheme-meta
+ */
+export function matchAllowedColorSchemes(content: string): AllowedColorScheme {
+ switch (content) {
+ case "light dark":
+ case "dark light":
+ case "light":
+ case "dark":
+ // content must match one of these types.
+ return content;
+ default:
+ return "normal";
+ }
+}