fix: correct operator precedence on grabOp tabbed-focus guard#524
Open
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
Open
fix: correct operator precedence on grabOp tabbed-focus guard#524mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
Conversation
In updateMetaWorkspaceMonitor():
if (!this.grabOp === Meta.GrabOp.WINDOW_BASE)
this.updateTabbedFocus(existNodeWindow);
`!` binds tighter than `===`, so this evaluates as
`(!this.grabOp) === Meta.GrabOp.WINDOW_BASE` — i.e. a boolean compared
to an integer, which is *always* false. updateTabbedFocus has therefore
never run from this code path.
The intent (matching every other GrabOp comparison in the codebase, all
of the form `grabOp === Meta.GrabOp.X`) is "skip the update only when
the grab op IS WINDOW_BASE" — i.e. don't yank tabbed focus while the
user is mid-drag. Replace with `this.grabOp !== Meta.GrabOp.WINDOW_BASE`.
Surfaces when a tabbed window is moved across workspaces/monitors
without an active grab — the tab head should follow the focus, but
currently doesn't.
2 tasks
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.
Summary
updateMetaWorkspaceMonitor()hasJavaScript binds
!tighter than===, so this evaluates as(!this.grabOp) === Meta.GrabOp.WINDOW_BASE— a boolean compared to an integer, which is always false.updateTabbedFocushas never run from this code path.Every other
Meta.GrabOpcomparison in the codebase is of the formgrabOp === Meta.GrabOp.X(seelib/extension/utils.jslines 227–250,lib/extension/window.jsline 2515 in the same file), so the typo is an isolated mistake.Intent (matching the comment "Ensure that the workspace tiling is honored"): skip the update only when the grab op is
WINDOW_BASE(i.e. don't yank tabbed focus mid-drag). Fix:User-visible effect
In a tabbed container, when a tabbed window is moved across workspaces or monitors without an active drag (e.g. via keyboard, programmatic move, dynamic workspace shift), the tab header should re-render to follow the focused window — currently it doesn't, because the
updateTabbedFocuscall is dead code.Test plan
node --checkSuper+Shift+1..9: with the fix, the tab head on the source workspace re-renders correctly.Notes
This is the kind of bug a typechecker (TS or even just
eslint --no-mixed-operators) would catch on the first pass; might be worth wiring one in eventually, but out of scope for this fix.