Closed Bug 1976480 Opened 3 months ago Closed 3 months ago

‘Copy Link to Highlight’ selects additional text

Categories

(Core :: DOM: Selection, defect)

Firefox 142
Desktop
All
defect

Tracking

()

VERIFIED FIXED
143 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox-esr140 --- unaffected
firefox141 --- unaffected
firefox142 --- disabled
firefox143 --- verified

People

(Reporter: oardelean, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached image quotehighlight.gif

Found in

  • Nightly 142.0a1;

Affected versions

  • Nightly 142.0a1;

Tested platforms

  • Windows 10;
  • macOS 15;
  • Ubuntu 22;

Affected platforms

  • Windows 10;
  • macOS 15;
  • Ubuntu 22;

Unaffected platforms

  • N/A;

Preconditions

  • dom.text_fragments.enabled to TRUE
  • dom.text_fragments.create_text_fragment.enabled set to TRUE

Steps to reproduce

  1. Launch Firefox.
  2. Go to https://en.wikipedia.org/wiki/Percent-encoding
  3. Select the double quotation mark - “ .
  4. Right-click on the selection and select ‘Copy Link to Highlight’.
  5. Open a new tab and paste the link in the address bar.
  6. Observe the highlighted paragraphs in the page.

Expected result

  • Only the quotation mark is highlighted.

Actual result

  • Highlight is also applied to the first word after the quotation mark.

Regression range

  • Not a regression.
Severity: -- → S3

This patch adds a new check in the beginning of the algorithm which leaves the
input range unchanged if its content is only punctuation characters.
This edge case is handled by checking if all characters are punctuation and would return early, hence not going into the algorithm that extends the range to word boundaries
(which would become more complex trying to achieve the same).

Additionally, this patch contains a minor refactoring: Other edge cases in the input range
(empty range, whitespace-only ranges) are moved into the function that extends the
range to word boundaries.

Assignee: nobody → jjaschke
Status: NEW → ASSIGNED
Pushed by jjaschke@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/57ee7d95ea71 https://hg.mozilla.org/integration/autoland/rev/79170f140f14 Text Fragments: Don't extend the selection if only punctuation is selected. r=dom-core,avandolder,mccr8
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
Regressions: 1979474

Verified during 143 Nightly testing on Mac and Ubuntu with additional manual verification for Windows.

Status: RESOLVED → VERIFIED
QA Whiteboard: [QA-4080] [qa-found-in-c142] → [QA-4080] [qa-found-in-c142][qa-ver-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: