Closed Bug 2038418 Opened 1 month ago Closed 28 days ago

Text selection is lost after move mouse pointer from contextmenu in certain case

Categories

(Core :: DOM: Selection, defect)

Firefox 152
Desktop
All
defect

Tracking

()

VERIFIED FIXED
152 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox150 --- unaffected
firefox151 --- unaffected
firefox152 --- verified
firefox153 --- verified

People

(Reporter: alice0775, Assigned: ltenenbaum)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(2 files)

Attached file testcase.html

Steps to reproduce:

  1. Open the attached testcase.html
  2. Right-click the selected text to display the context menu.<br>
  3. Move the mouse pointer over the menu.<br>
  4. Move the mouse pointer outside the menu.

Actual results:
Text selection will be removed.
Screencast: https://youtu.be/KxsQqjPx7gE

Expected results:
The text selection should remain unchanged.

Regression window:
https://hg-edge.mozilla.org/integration/autoland/pushloghtml?fromchange=f5e2ce3571f7886ab30ecfd9f33027581c53e8ac&tochange=088ccf5be2cc238d3758f606b82ff25fcf8e8ce9

:ltenenbaum, since you are the author of the regressor, bug 2032191, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(ltenenbaum)

This issue also reproduces on Nightly152.0a1 on Ubuntu 24.04.

OS: Windows 11 → All
Summary: Text selection lost after move mouse pointer from contextmenu in certain case → Text selection is lost after move mouse pointer from contextmenu in certain case
Attached file test.html

Yes, unfortunately this happens due to the hack we added in bug 2032191 of setting the selection when the focused element becomes non-focusable to prevent regressions. Here's a simpler case that exhibits the same behavior (really, it is more to do with removing the tabindex attribute than opening the contextmenu). We could fix this by not changing the selection if it is already in the focused element, but this will be fixed by bug 2034851, which will hopefully make it into 152 anyways…

Flags: needinfo?(ltenenbaum)
Assignee: nobody → ltenenbaum
Severity: -- → S3
Status: NEW → ASSIGNED
See Also: → 2034851
Status: ASSIGNED → RESOLVED
Closed: 28 days ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
Depends on: 2034851
See Also: 2034851
QA Whiteboard: [qa-ver-opt-c153/b152][qa-triage-done-c153/b152]

Reproducible on a 2026-05-09 Firefox Nightly build on Windows 10.

Verified as fixed on Firefox Nightly 153.0a1 and Firefox 152.0b2 on Windows 10, Ubuntu 22, macOS 15.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-ver-opt-c153/b152][qa-triage-done-c153/b152] → [qa-ver-done-c153/b152][qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: