Skip to content

gh-14984: Fix tab strip staying offset when a space swipe is interrupted - #14985

Open
obi12341 wants to merge 5 commits into
zen-browser:devfrom
obi12341:fix/7340
Open

gh-14984: Fix tab strip staying offset when a space swipe is interrupted#14985
obi12341 wants to merge 5 commits into
zen-browser:devfrom
obi12341:fix/7340

Conversation

@obi12341

Copy link
Copy Markdown

Closes #14984

ZenSpacesSwipe only cleans up in onSwipeGestureAnimationEnd(), which is wired to
MozSwipeGestureEnd. When a gesture is abandoned — the window is deactivated, or a popup
takes over — that event never arrives and nothing recovers the state:

  • the translateX(...) applied by _handleSwipeUpdate stays on the strip, and
  • swipe-gesture="true" stays on documentElement, keeping
    :root[swipe-gesture] #tabbrowser-arrowscrollbox { pointer-events: none } ([1.19.13b] Workspace swiping will ocassionally be stuck. #13703)
    active, which is what stops the tab list from scrolling.

This adds #abortGesture(), which puts the strip back on the current space, clears the
essentials transforms and runs the existing cleanup. It is triggered on deactivate and on
visibilitychange while hidden. _popupOpenHandler now goes through it as well — that path
had the same defect, since it reset the swipe state but never the transform.

@obi12341
obi12341 requested a review from mr-cheffy as a code owner August 15, 2026 21:56
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug labels Aug 15, 2026
@mr-cheffy

Copy link
Copy Markdown
Member

Have you tested this fix?

// Cleanup only runs on MozSwipeGestureEnd, which never arrives when the window
// stops receiving the rest of the gesture. The strip then keeps its offset and
// the tab strip its disabled pointer events, see gh-13703 for those.
#attachGestureAbortTriggers() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are not needed imo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure, you marked this as resolved but the function is still here?

@obi12341 obi12341 Aug 16, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry, I read your comment as being about the comment block above the function and
removed that.

Do you mean the helper itself? I can fold those two addEventListener calls into
#attachWorkspaceSwipeGestures so there is no extra function, same behaviour.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, I meant the helper itself. Since the chrome window wont ever call visibilitychange and deactivate is already handled by the swipe manager.

Comment thread src/zen/spaces/ZenSpacesSwipe.mjs Outdated
for (const container of document.querySelectorAll(
"#zen-essentials .zen-workspace-tabs-section"
)) {
container.style.removeProperty("transform");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem like a good idea? Why did you change this? We should animate back to the original space. Why wasn't onSwipeGestureAnimationEnd working out?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You're right about animating back. Switched to _cancelSwipeAnimation() and dropped both
the manual _organizeWorkspaceStripLocations call and the essentials loop.

On onSwipeGestureAnimationEnd: in this scenario it never runs at all, because it is only
wired to MozSwipeGestureEnd, and the widget never sends that once the window stops
receiving the gesture.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 15, 2026
@obi12341
obi12341 requested a review from mr-cheffy August 15, 2026 22:46
@obi12341

Copy link
Copy Markdown
Author

Have you tested this fix?

Yes. Measured on a build of this branch with a clean profile, driving the gesture with
synthetic MozSwipeGesture* events plus a minimize/restore cycle.

// Cleanup only runs on MozSwipeGestureEnd, which never arrives when the window
// stops receiving the rest of the gesture. The strip then keeps its offset and
// the tab strip its disabled pointer events, see gh-13703 for those.
#attachGestureAbortTriggers() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure, you marked this as resolved but the function is still here?

@obi12341
obi12341 requested a review from mr-cheffy August 22, 2026 17:12

@mr-cheffy mr-cheffy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as before

@mr-cheffy

Copy link
Copy Markdown
Member

It all looks very ai generated and half of the stuff doesnt make much sense

@mr-cheffy mr-cheffy closed this Aug 23, 2026
@obi12341

Copy link
Copy Markdown
Author

@mr-cheffy The PR fixes a real bug and includes a test that demonstrates it. If you don't understand the bug itself you could have asked.

I asked how you wanted the code structured so it would be acceptable to you. I got no answer for a week, then a close.
That is not a review, and it is not a reasonable way to treat people contributing work to this project.
We've been supporting Zen on Patreon. We'll be stopping.

@mr-cheffy

mr-cheffy commented Aug 23, 2026

Copy link
Copy Markdown
Member

@obi12341 Im truly sorry, I missed that part. Seems like the comments got marked as resolved and hence stayed collapsed / hidden. I'll reopen and answer.

@mr-cheffy mr-cheffy reopened this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interrupted space swipe leaves the tab strip offset and stops the sidebar from scrolling

2 participants