Skip to content

Prevent fallback context menu dismiss clicks from triggering underlying UI #283

@krishkalaria12

Description

@krishkalaria12

This issue appears to have been addressed in PR #280

Please verify the current behavior against that PR and fix anything still remaining or regressed.

Problem

In apps/web/src/contextMenuFallback.ts, the fallback context menu closes on outside pointerdown, but the dismissing event may continue to the element underneath.

Because the listener is registered in capture phase, an outside click that is only meant to close the menu can still reach the background target after the menu is dismissed. That can trigger unintended UI actions behind the menu.

What to check

Inspect the fallback context menu implementation in:

  • apps/web/src/contextMenuFallback.ts

Also verify the renderer path that uses it, including any changes from PR #280:

Expected behavior

When the user clicks outside the fallback context menu:

  • the menu should close
  • the dismissing click should be consumed
  • the underlying UI should not receive that click

At the same time:

  • clicking inside the menu should still work normally
  • menu items should still resolve correctly
  • Escape dismissal should still work
  • menu positioning / visibility behavior should remain correct
  • no new double-rendering or extra-layer issues should be introduced

Implementation request

Please make a minimal, targeted fix.

  1. Inspect apps/web/src/contextMenuFallback.ts.
  2. Update the outside-click dismissal path so the pointer event is properly consumed before cleanup.
  3. Preserve existing menu behavior for:
    • item clicks
    • outside-click close
    • Escape close
    • menu positioning and visibility
  4. Add or update a regression test if there is a practical existing place for it.
  5. Run verification:
    • bun lint
    • bun typecheck
    • if repo-wide bun typecheck still fails because of unrelated existing issues, note that clearly and also confirm the relevant package typecheck passes
    • if running tests, use bun run test, not bun test

Acceptance criteria

  • Outside-click dismissal of the fallback context menu does not trigger the underlying UI.
  • Existing context menu interactions continue to work.
  • The fix is verified with lint/typecheck and any relevant targeted tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions