Skip to content

Fix flicker on page load when color mode is set to dark #15340

@jeremystretch

Description

@jeremystretch

Deployment Type

NetBox Cloud

NetBox Version

v4.0

Python Version

3.11

Steps to Reproduce

  1. Open the NetBox UI as an anonymous user (not logged in)
  2. Click the toggle button at top right to switch to dark mode
  3. Navigate among pages several times

Expected Behavior

The application of the dark mode theme should persistent without interruption between page loads.

Observed Behavior

A "flicker" is sometimes visible when a new page loads, as the DOM is initially rendered in light mode and then switched to dark mode. This occurs because the user's preferred theme is being read from local storage after the DOM has finished loading.

Note that this does not occur when authenticated as a known user with the color preference set to dark mode. (In this case, data-bs-theme="dark" is set on each page's <body> tag directly in the page source.)

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtopic: UI/UXUser interface or user experience related worktype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions