Skip to content

Draft: fix(addon-mobile): correct sheet dialog theme-color handling#14515

Open
loxy wants to merge 1 commit into
taiga-family:mainfrom
loxy:fix/sheet-dialog-theme-color
Open

Draft: fix(addon-mobile): correct sheet dialog theme-color handling#14515
loxy wants to merge 1 commit into
taiga-family:mainfrom
loxy:fix/sheet-dialog-theme-color

Conversation

@loxy

@loxy loxy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Three independent failure modes in TuiSheetDialogService / TuiThemeColorService around <meta name="theme-color"> handling:

  • Capture the theme color at the moment the first sheet opens instead of once at construction, so a theme change made after the service was created (e.g. an app-level dark-mode effect) is no longer lost on revert, and nested sheets no longer revert onto the sheet color.
  • Make the sheet color configurable via themeColor on TUI_SHEET_DIALOG_OPTIONS (defaults to #404040, null opts out) instead of a hardcoded constant that only matched the backdrop in light mode.
  • Split TuiThemeColorService: color now writes only the <meta name="theme-color"> tag, while the new navColor setter writes the --tui-theme-color CSS variable used by navigation chrome. Dimming the address bar no longer flickers the nav.

Adds a jest spec (revert / nesting / opt-out matrix), a Cypress test for the real-browser open/close behavior, and a themeColor docs example.

Fixes #13690

@loxy
loxy requested a review from a team as a code owner July 6, 2026 15:27
@loxy
loxy requested review from MarsiBarsi, mdlufy, nsbarsukov, sayranovv, vladimirpotekhin and waterplea and removed request for a team July 6, 2026 15:27
@bundlemon

bundlemon Bot commented Jul 6, 2026

Copy link
Copy Markdown

BundleMon

Unchanged files (2)
Status Path Size Limits
demo/browser/styles-(hash).css
20.65KB +10%
demo/browser/main-(hash).js
1014B +10%

Total files change +2B +0.01%

Groups updated (1)
Status Path Size Limits
demo/browser/*.js
3.21MB (+2.1KB +0.06%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Tests completed successfully ✅

Good job 🔥

@loxy loxy changed the title fix(addon-mobile): correct sheet dialog theme-color handling Draft: fix(addon-mobile): correct sheet dialog theme-color handling Jul 6, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@loxy

loxy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Hi @waterplea — this is the v5 PR bundling the three theme-color fixes you greenlit in discussion #14124. Refs #13690.

Marked draft on purpose: the fixes are done and covered (jest + a Cypress test), but three API-shape calls are yours to make before I finalize:

  1. Configurable color — I implemented themeColor on TUI_SHEET_DIALOG_OPTIONS as a provider/global default (null opts out). Do you also want a per-open() / directive override, or is the provider default enough?
  2. Split naming & compatcolor now writes only <meta name="theme-color">, and a new navColor writes the --tui-theme-color CSS var. OK with that split and a clean v5 break, or would you prefer a back-compat shim on the existing setter?
  3. Revert model — I capture the initial color at the first open (0 → 1) rather than in the constructor. Happy to switch to an initial-color stack if you had a different mechanism in mind for the nested case.

One heads-up from on-device testing: the address-bar (theme-color) effect no longer renders on iOS 26 Safari (ignores the meta, derives the toolbar from CSS edge backgrounds) or Chrome dark mode (overrides it). It still works on Chrome light / iOS ≤ X?, so the fixes are valid — but the --tui-theme-color (nav) path is the more durable one now. A CSS-based toolbar approach for iOS 26 might be worth a separate discussion down the line.

@loxy
loxy force-pushed the fix/sheet-dialog-theme-color branch 2 times, most recently from 0111b64 to 277b13c Compare July 6, 2026 16:03
Three independent failure modes in TuiSheetDialogService /
TuiThemeColorService around `<meta name="theme-color">` handling:

- Capture the theme color at the moment the first sheet opens instead
  of once at construction, so a theme change made after the service was
  created (e.g. an app-level dark-mode effect) is no longer lost on
  revert, and nested sheets no longer revert onto the sheet color.
- Make the sheet color configurable via `themeColor` on
  TUI_SHEET_DIALOG_OPTIONS (defaults to #404040, `null` opts out)
  instead of a hardcoded constant that only matched the backdrop in
  light mode.
- Split TuiThemeColorService: `color` now writes only the
  `<meta name="theme-color">` tag, while the new `navColor` setter
  writes the `--tui-theme-color` CSS variable used by navigation
  chrome. Dimming the address bar no longer flickers the nav.

Adds a jest spec (revert / nesting / opt-out matrix), a Cypress test
for the real-browser open/close behavior, and a `themeColor` docs
example.
@loxy
loxy force-pushed the fix/sheet-dialog-theme-color branch from 277b13c to 1ea8dc0 Compare July 6, 2026 16:04

@waterplea waterplea left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good, thank you very much! I think I only have couple of concerns:

  1. Maybe let's not change the TuiThemeColorService and handle metadata directly in TuiSheetDialogService using Meta?
  2. We can probably not introduce null and just use empty string as falsy value for opt-out? If you prefer more expressive null we can still use !themeColor in checks since empty string also makes no sense as color
  3. What's the purpose of const {themeColor} = this.options;? Seems like an extra line, can we just use this.options.themeColor?

@loxy

loxy commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the feedback. I'm on vacation currently. Don't know how much time I will have next days. But I will try to address your suggestions and remarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

🐞 - Status bar coloring during NotificationMiddle opening

2 participants