Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(menu): opening CDK context menu loose text selection on Firefox #29703

Open
1 task
MikaStark opened this issue Sep 6, 2024 · 0 comments
Open
1 task

bug(menu): opening CDK context menu loose text selection on Firefox #29703

MikaStark opened this issue Sep 6, 2024 · 0 comments
Labels
area: cdk/menu firefox This issue is specific to the Firefox browser P4 A relatively minor issue that is not relevant to core functions

Comments

@MikaStark
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hi there,

I’ve been working with CdkContextMenuTrigger in conjunction with CdkMenu and attempting to implement a copy/paste feature. However, I’ve encountered an issue specifically in Firefox: when the context menu opens, the selected text is unexpectedly unselected.

After some investigation, it appears that Firefox may automatically deselect text when focus shifts to elements outside the text container. While this behavior might be a limitation inherent to Firefox, I believe it is worth documenting.

Additionally, it is worth noting that the official CDK context menu example includes mocked "copy" and "cut" options, which exacerbates this issue.

Is this behavior something that can be addressed, or is it an inherent limitation of how Firefox handles text selection and focus?

Thanks!

Reproduction

StackBlitz link: cf. https://material.angular.io/cdk/menu/examples
Steps to reproduce:

  1. Go to https://material.angular.io/cdk/menu/examples with Firefox
  2. In "Context menu" example, try to select a portion of text and right click on it
  3. See the menu is opened but the text is no more selected

Expected Behavior

The text should remains selected

Actual Behavior

The text is no more selected

Environment

  • Angular: 18.2.3
  • CDK/Material: 18.2.3
  • Browser(s): Firefox 130.0 (64 bits)
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu 24.04
@MikaStark MikaStark added the needs triage This issue needs to be triaged by the team label Sep 6, 2024
@crisbeto crisbeto added P4 A relatively minor issue that is not relevant to core functions firefox This issue is specific to the Firefox browser area: cdk/menu and removed needs triage This issue needs to be triaged by the team labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/menu firefox This issue is specific to the Firefox browser P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

2 participants