primitives icon indicating copy to clipboard operation
primitives copied to clipboard

[ContextMenu] Safari Text Selection Gets Cleared by Context Menu

Open brajabi opened this issue 2 years ago • 5 comments

Bug report

When selecting text on a page in Safari and then right-clicking to open the context menu, the selected text gets cleared/unselected.

Steps to Reproduce

  1. Select some text on a page in Safari by highlighting with cursor.
  2. Right-click on the selected text.
  3. Observe that the context menu opens, but the text is no longer selected/highlighted.

https://github.com/radix-ui/primitives/assets/26709290/fae607fd-d8e8-4eae-bff6-e80797ce26ea

I fixed some of the problem with this prop to ContextMenuContent but still has problem

onOpenAutoFocus={(event: any) => {
          // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
          event.preventDefault();
        }}

https://github.com/radix-ui/primitives/assets/26709290/e41243d4-6d4b-4682-958b-904db0873896

I don't have this problem in chrome.

brajabi avatar Sep 24 '23 06:09 brajabi

I'm having the same bug with Popover. When I open the menu it de-selects the text in Safari. It's so annoying.

jmantonellini avatar Apr 11 '24 17:04 jmantonellini

Able to reproduce here! Implementing a spellchecker which requires the text to stay focused. What can we do to help fix this?

alii avatar Apr 22 '24 13:04 alii

Someone have found a workaround for this?

agnarok avatar May 08 '24 13:05 agnarok

+1

andersonba avatar Jul 09 '24 09:07 andersonba

Anybody figured this one out yet? Running into the same issue.

awallish avatar Oct 08 '24 23:10 awallish