FIX: Render the correct logo for the active scheme when logo is minimized #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's currently a bug where if you use the color scheme toggler to switch to the opposite color mode of your system preference, i.e. enable light mode when your system preference is dark and vice versa, the header logo renders the version matching your system preference instead of the selected choice made via the toggler the next time the logo is minimized or expanded (e.g. when scrolling in a long topic).
The bug occurs because when you switch your color scheme via the toggler component, the component updates all the relevant DOM elements that are currently in-view, but subsequent changes to the DOM made by the app, e.g. when the header logo is minimized/expanded, aren't aware of the new choice and resort to the system preference.
This PR fixes the bug by adding a hook to the header logo that gets called when the logo is minimized/expanded and making sure the user's scheme choice is applied to the logo when it's re-rendered.
Internal topic: t/144688.