Closed Bug 1832275 Opened 3 years ago Closed 2 years ago

selection.addRange() fails to highlight text or make it copyable when triggered by a return to page focus after previously being in a textbox

Categories

(Core :: DOM: Selection, defect)

Firefox 115
defect

Tracking

()

VERIFIED FIXED
115 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox113 --- wontfix
firefox114 --- wontfix
firefox115 --- verified
firefox116 --- verified

People

(Reporter: ke5trel, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

STR:

  1. Open the attached test page (based on MDN addRange() example).
  2. Click the textbox to focus it.
  3. Press Ctrl+F to move keyboard focus outside the page.
  4. Click the button "Select strong words".
  5. Copy selection with Ctrl+C or context menu.
  6. Paste in find bar.
  7. Click in the page.
  8. Repeat steps 2-4.

Expected:
The bold text is selected and can be copied and pasted.

Actual:
Selection appears to work but copying fails and after clicking in the page, the button no longer selects text when STR repeated until the page is refreshed.

Only the first click event that triggers selection.addRange() when returning focus to a page where a textbox previously had focus is affected.

First regression window (copy failure):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=737aba43bfa1685fa15a9b542636b959397603a8&tochange=018964cefa63a14d1e43b31be1b91526a9d708fc

Most likely by regressed by Bug 253870.

Second regression window (selection failure):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=9f3f88599fffa54ddf0c744b98cc02df99f8d0b8&tochange=01b9bdb6e5ef2a19e1c3311a47569d62f275db1f

Most likely by regressed by Bug 1623837.

Severity: -- → S3

Emilio, could you have a look? Thanks!

Flags: needinfo?(emilio)

Needs a test (though it might be hard to construct).

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Bug 582459 made testing this a lot harder :(

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4e932e16b428 Fix up focused selection when focus returns to something else. r=masayuki
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
Flags: qe-verify+

Reproducible on Firefox 104.0.1(build ID: 20230608214645) on Ubuntu 22.
Verified as fixed on Firefox 115.0b4(build ID: 20230611180300) and Nightly 116.0a1(build ID: 20230612211509) on Ubuntu 22, macOS 12, Windows 10.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: