Skip to content

improvement(shell-ui): paint the theme background before the app loads (ARTESCA-18437) - #5175

Open
Cuervino wants to merge 2 commits into
development/134.0from
improvement/ARTESCA-18437-shell-dark-background-before-load
Open

Cuervino wants to merge 2 commits into
development/134.0from
improvement/ARTESCA-18437-shell-dark-background-before-load

Conversation

@Cuervino

@Cuervino Cuervino commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Every page load shows a white flash before the shell renders, even in dark mode. The HTML template sets no background, so the browser paints its default white until React mounts and the theme applies.

This adds a small inline script to index-template.html that reads the theme already stored by ShellThemeSelectorProvider (localStorage.theme, dark by default) and sets the matching background on <html> before anything else loads.

The two colors are the backgroundLevel1 of the themes ARTESCA configures (darkRebrand and artescaLight). They are hard-coded because the theme is not available yet at that point.

Fixes ARTESCA-18437.

@Cuervino
Cuervino requested a review from a team as a code owner October 16, 2026 17:31
@bert-e

bert-e commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Hello cuervino,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@Cuervino

Copy link
Copy Markdown
Contributor Author

/changie Enhanced Remove the white flash on page load in dark mode

@bert-e

bert-e commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Request integration branches

Waiting for integration branch creation to be requested by the user.

To request integration branches, please comment on this pull request with the following command:

/create_integration_branches

Alternatively, the /approve and /create_pull_requests commands will automatically
create the integration branches.

Auto-generated-by: changie-add-changelog
@eve-ci-cd
eve-ci-cd Bot requested a review from a team as a code owner October 16, 2026 17:31
@eve-ci-cd
eve-ci-cd Bot requested review from eg-ayoub and riadelhajjaji-scality and removed request for a team October 16, 2026 17:32
@github-actions

Copy link
Copy Markdown
Contributor

✅ Changelog check passed.

var light = localStorage.getItem('theme') === 'light';
var root = document.documentElement;
root.style.backgroundColor = light ? '#FCFCFC' : '#121219';
root.style.colorScheme = light ? 'light' : 'dark';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These inline styles on <html> are never updated afterwards. When the user switches theme from the navbar (setThemeMode in ShellThemeSelectorProvider.tsx), <html> keeps the old background and color-scheme until reload. In light mode that leaves dark scrollbars, dark native form controls and a dark overscroll area. Fix: update document.documentElement.style.backgroundColor/colorScheme in changeThemeMode (or in an effect on themeMode, using selectedTheme.backgroundLevel1), or remove the inline styles once the app has mounted.

— Claude Code

@claude

claude Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor
  • <html> background and color-scheme set in index-template.html are not updated when the theme is switched at runtime, so they stay out of sync until reload
      - Update them in ShellThemeSelectorProvider.changeThemeMode (or an effect on themeMode) using selectedTheme.backgroundLevel1
      - Or clear the inline styles once the app has mounted

    Review by Claude Code

@JeanMarcMilletScality JeanMarcMilletScality left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One gap: the script sets background-color and color-scheme on once, at load time, and nothing updates them afterwards. After switching from dark to light
without reloading, keeps the dark background and color-scheme: dark until the next reload.

I suggest letting the provider take over once it mounts, so the values come from the real theme after the first paint:

// ShellThemeSelectorProvider.tsx
useEffect(() => {
const root = document.documentElement;
root.style.backgroundColor = selectedTheme.backgroundLevel1;
root.style.colorScheme = themeMode;
}, [selectedTheme, themeMode]);

Optional: the themes come from config.json, so the two hard-coded colors can drift. The provider could store backgroundLevel1 in
localStorage for the script to read, with the current colors as a fallback for the first visit.

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.

3 participants