fix(funbox): deselecting funbox effects does not reset without refresh (@d1rshan)#7582
Open
d1rshan wants to merge 4 commits intomonkeytypegame:masterfrom
Open
fix(funbox): deselecting funbox effects does not reset without refresh (@d1rshan)#7582d1rshan wants to merge 4 commits intomonkeytypegame:masterfrom
d1rshan wants to merge 4 commits intomonkeytypegame:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a UI/state desync in the typing-test “funbox” system where deselecting multiple funbox effects removed UI indicators but left effects active until refresh (by ensuring all injected funbox stylesheets/classes are fully resynced on config changes).
Changes:
- Remove all
.funBoxTheme<link>tags viaqsa(...).remove()(instead of only the first match). - Add
syncFunboxStateWithConfig()and run it on everyfunboxconfig event to clear inactive funbox globals, recomputefb-*body classes, and reapply active funbox CSS.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines
223
to
225
| "class", | ||
| [...new Set([...currentClasses, ...activeFbClasses]).keys()].join(" "), | ||
| ); |
There was a problem hiding this comment.
Body class recompute can leave stale ignore-reduced-motion behind after disabling the last funbox with ignoreReducedMotion because non-fb- classes are preserved. Ensure ignore-reduced-motion is removed from the preserved set before conditionally re-adding it based on active funboxes.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When multiple funbox effects were deselected, the UI showed them as disabled but effects
remained active until refresh.
Root cause
.funBoxThemecleanup originally removed only one stylesheet element, so stale funboxCSS links could remain in the DOM.
asyncdespite doing synchronous DOM work, creatingmicrotask yield points.
toggleFunboxalso manually applied/cleared global effects, which could duplicateeffects when subscriber sync ran too.
Fix
qsa(".funBoxTheme").remove()to remove all funbox stylesheet links.syncFunboxStateWithConfig()on funbox config events to:fb-*body classessetFunboxBodyClasses,applyFunboxCSS,syncFunboxStateWithConfig).clearGlobal/applyGlobalCSScalls intoggleFunboxto avoidduplicate DOM overlays.
Manually verified by enabling multiple funboxes and deselecting them; effects are removed immediately without refresh.
Closes #7468