Skip to content

feat(#3873): add dark mode theming with React context and Angular service#3874

Open
twjeffery wants to merge 11 commits into
devfrom
tom/dark-mode-svelte-hooks
Open

feat(#3873): add dark mode theming with React context and Angular service#3874
twjeffery wants to merge 11 commits into
devfrom
tom/dark-mode-svelte-hooks

Conversation

@twjeffery
Copy link
Copy Markdown
Collaborator

@twjeffery twjeffery commented Apr 24, 2026

Summary

Four small Svelte changes so dark mode can target colours that are currently hardcoded.

Changes

  1. reset.css body background. Changed #fff to reference --goa-color-greyscale-white.

  2. Dropdown native chevron. Replaced the pseudo-element chevron (hardcoded #333 stroke) with an inline SVG that follows --goa-dropdown-color-text. Same size and position as before.

  3. WorkSideMenu account popover background. Added --goa-work-side-menu-account-bg so dark mode can give the popover its own background. Token is added in the design-tokens package in feat(#3873): add work-side-menu-account-bg token design-tokens#154.

  4. AppHeader and WorkSideMenu logos. Added dark variant SVGs and a MutationObserver on the data-theme attribute so logos swap between light and dark when the theme changes.

Note on the logo pattern

The logos use JS (a MutationObserver on the data-theme attribute) to swap the <img src> between light and dark variants. The rest of the dark mode story is pure CSS cascade. This inconsistency is intentional for now: multi-colour branded imagery doesn't convert cleanly to currentColor-based inline SVG, and a proper refactor would be significantly larger. Happy to discuss a cleaner pattern in a follow-up if the team prefers.

Context

Companion to #3850 (dark mode spike). The spike covered most of dark mode through token overrides. These changes address the shadow-DOM gaps the cascade can't reach.

How to test

  1. npm install
  2. npx nx serve react-prs
  3. On the Everything page, Dropdowns section, the new native dropdown should look the same as before.
  4. Logo swap: open devtools, run document.documentElement.setAttribute('data-theme', 'dark'). AppHeader and WorkSideMenu logos swap. Run with 'light' to swap back.

Fixes #3873

@twjeffery twjeffery marked this pull request as ready for review April 24, 2026 04:30
@twjeffery twjeffery marked this pull request as draft April 24, 2026 15:55
@twjeffery twjeffery removed the request for review from vanessatran-ddi April 24, 2026 15:55
@twjeffery twjeffery force-pushed the tom/dark-mode-svelte-hooks branch from f6d7723 to d3c0858 Compare April 24, 2026 15:56
@twjeffery twjeffery changed the title feat(#3873): add dark mode styles to Dropdown, WorkSideMenu, and body feat(#3873): add dark mode styles to AppHeader, Dropdown, WorkSideMenu, and body Apr 24, 2026
@twjeffery twjeffery marked this pull request as ready for review April 24, 2026 16:20
@vanessatran-ddi vanessatran-ddi marked this pull request as draft April 27, 2026 14:15
@vanessatran-ddi vanessatran-ddi self-assigned this Apr 27, 2026
@vanessatran-ddi vanessatran-ddi force-pushed the tom/dark-mode-svelte-hooks branch 4 times, most recently from 6a949ce to 7c13087 Compare May 4, 2026 20:43
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://GovAlta.github.io/ui-components/pr-preview-angular/pr-3874/

Built to branch gh-pages at 2026-05-11 21:47 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Preview links

Target URL
Docs https://govalta.github.io/ui-components/pr-preview/pr-3874/
React playground https://govalta.github.io/ui-components/pr-preview-react/pr-3874/
Angular playground https://govalta.github.io/ui-components/pr-preview-angular/pr-3874/

Built from commit ee14e9d. Previews are removed automatically when this PR closes.

@vanessatran-ddi vanessatran-ddi changed the title feat(#3873): add dark mode styles to AppHeader, Dropdown, WorkSideMenu, and body feat(#3873): add dark mode theming with React context and Angular service May 4, 2026
@vanessatran-ddi vanessatran-ddi force-pushed the tom/dark-mode-svelte-hooks branch from e0da260 to f053c07 Compare May 4, 2026 21:37
@vanessatran-ddi vanessatran-ddi marked this pull request as ready for review May 4, 2026 21:43
@ArakTaiRoth ArakTaiRoth deleted the branch dev May 5, 2026 18:28
@ArakTaiRoth ArakTaiRoth closed this May 5, 2026
@vanessatran-ddi vanessatran-ddi force-pushed the tom/dark-mode-svelte-hooks branch from 9b15657 to 7683a4e Compare May 5, 2026 22:45
@twjeffery twjeffery force-pushed the tom/dark-mode-svelte-hooks branch from 95e5d8a to 9338255 Compare May 6, 2026 22:02
@Spark450 Spark450 self-requested a review May 6, 2026 22:41
Comment thread docs/src/pages/get-started/developers/dark-mode-theme.astro
Comment thread docs/src/components/nav/MenuSecondaryContent.tsx Outdated
@twjeffery
Copy link
Copy Markdown
Collaborator Author

@Spark450 I addressed your comments, the preview link should be updated now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
border-top: 1px solid var(--goa-color-greyscale-200);

There's a couple other hard-coded values that we can address here too.

Comment on lines 75 to 90
::placeholder {
/* Chrome, Firefox, Opera, Safari 10.1+ */
color: #999;
opacity: 1;
/* Firefox */
}

:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: #999;
}

::-ms-input-placeholder {
/* Microsoft Edge */
color: #999;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
::placeholder {
/* Chrome, Firefox, Opera, Safari 10.1+ */
color: var(--goa-input-color-text-placeholder);
opacity: 1;
/* Firefox */
}
:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: var(--goa-input-color-text-placeholder);
}
::-ms-input-placeholder {
/* Microsoft Edge */
color: var(--goa-input-color-text-placeholder);
}

I'm not sure how often teams use standard input elements but we can use a token to ensure the placeholder colour looks good in dark mode.

@vanessatran-ddi vanessatran-ddi force-pushed the tom/dark-mode-svelte-hooks branch from 87d7a91 to dbe5e00 Compare May 11, 2026 15:03
@vanessatran-ddi vanessatran-ddi requested a review from bdfranck May 11, 2026 15:17
Comment on lines +73 to +74
outline: var(--goa-link-gap-small, 3px) solid
var(--goa-color-interactive-focus);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
outline: var(--goa-link-gap-small, 3px) solid
var(--goa-color-interactive-focus);
outline: var(--goa-link-border-focus);

We can use a link-specific token here.

Copy link
Copy Markdown
Collaborator

@bdfranck bdfranck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the changes...

  • ✅ The hardcoded values are replaced with tokens
  • ✅ All the tokens are valid

Looks good! 👍 I have one more comment about a link token.

@vanessatran-ddi vanessatran-ddi requested a review from bdfranck May 11, 2026 23:44
Copy link
Copy Markdown
Collaborator

@bdfranck bdfranck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the latest changes and I see the link focus uses our design token. Looks good to me! 👍

</div>

{/* Middle pages (after groups) */}
{MIDDLE_PAGES.map((page) => (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIDDLE_PAGES is never defined anywhere. This causes the side menu to disappear if Get Started is ever clicked.

@@ -0,0 +1,62 @@
---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page doesn't belong to the new Get Started collection, as such it isn't indexed for searching

@@ -0,0 +1,267 @@
---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this page

@twjeffery twjeffery linked an issue May 13, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dark mode support for the design system Add dark mode styles to AppHeader, Dropdown, WorkSideMenu, and body

5 participants