fix(mobile): a long press lifts the whole session tab, not its text

Merged
SA
2mo ago
+34-22

Press and hold a session tab and the title swelled out of the pill while the pill stayed where it was — it read as the text resizing itself rather than the tab being picked up.

Cause

Modifier order, not the animation. The pill's fill was applied after .contextMenu, so iOS's lift snapshotted only the button's label — the mark and the title — with no pill behind it. The label scaled; the fill underneath did not.

Fix

  • The fill moves inside the button's label, after the mask, so the close-disc gradient still fades only the title and not the pill's tail.

  • .contextMenu moves below the close-disc overlay, so the preview carries the disc too.

  • .contentShape(.contextMenuPreview, shape) hands the lift the pill's shape. Without it the preview takes the system's menu radius and the tab rounds off into a capsule as it grows. Corner inset off the simulator, normalised to the pill's height so scale drops out:

    depth into corner2%5%10%20%
    at rest0.2190.1370.0960.027
    held, system radius0.3810.3100.2260.107
    held, pill radius0.2020.1550.0950.024

iOS's lift can't be switched off while this is a .contextMenu; it can only be made to lift the right thing.

Verification

No apps/mobile/ios prebuild in the worktree, so the real file was compiled into a bare SwiftUI harness and driven with Maestro on an iPhone 17 Pro Max sim, recording video. At rest the before/after builds are pixel-identical.

Moving the menu below the close disc puts that disc inside the menu's press region, which was the real risk — so every callback was asserted: tap-to-select, ✕-to-close, and the menu opening from the tab body, from the ✕, and from an unselected tab, with Rename / Copy session ID / Close session all firing.

Video, stills and the measurements: https://app.superset.sh/page/session-tab-press-animation-3kn54g


Summary by cubic

Fixes long press on session tabs so the entire pill lifts, not just the title text. Reorders the SwiftUI modifiers so the context menu preview captures the full tab pill — fill and close disc — and confines the lift to the pill's own shape instead of the system's default radius.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the visual layering of composer session tabs.
    • Updated long-press context menu previews to use the tab pill’s rounded shape.