Closed Bug 1698705 Opened 4 years ago Closed 4 years ago

Double-click doesn't select the last word of the line if there is no end punctuation and next element is inline-block

Categories

(Core :: DOM: Selection, defect, P2)

60 Branch
defect

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- fixed

People

(Reporter: tustamido, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

As anyone who knows how much easier double-click + drag makes text selection (you don't have to aim at word boundaries), I use that feature a lot.

But I'm annoyed that it doesn't work properly in WhatsApp Web. If the last line of a message (almost vertically aligned with message time) doesn't have end punctuation, I can't select the last word. If I insist by dragging all the way to the right, then the last word is selected, but message time is selected too ("18:08" is how time is formatted here, just in case). It's impossible to include the last word without selecting the hour (18) too.

So I stripped down the code until I got the bare minimum to reproduce the issue. See the attachment.

You can't select the last word of the line by double-clicking it. And if you double-click a word before and drag to the end of the line, still the last word wouldn't be selected.

Even if you double-click far to the right of the end of the line and drag to the left, last word is skipped in selection.

Then I ran mozregression and found out that it's a regression. As Mozilla deletes autoland builds from over a year ago, I can't point to the exact change that cause the regression, but this is the range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=3804441e575c9f46fcb03894de3c780eeae7197f&tochange=ee7f64d0764961e9663c681efc8d2b3759af79d6

Works fine in Blink.

You shoud also notice that if you include an end punctuation in the line, then you can select until the end including the punctuation.

Has Regression Range: --- → yes
Keywords: regression
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)

What the rest of the selection code uses is IsBlockOutside, which is the
right thing to do here.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Thanks for the excellent reduced test-case, and Alice for finding the regression range!

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4551319b3f43 Fix bogus block-frame check in GetRangeForFrame. r=saschanaz
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28104 for changes under testing/web-platform/tests

(In reply to Alice0775 White from comment #2)

Regression window:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=0be3532802e3bad1ad91ee635a6b7abb902d3d27&tochange=0be927d6e79e5b2fc06efef46569f4df2890ee93

Sorry for the offtopic, but how did you get that range? For me, mozregression doesn't go beyond what I posted. It would be very useful to be able to get more specific ranges for builds from over a year ago.

And Emilio, thanks for the fix!

Severity: -- → S3
Priority: -- → P2
Upstream PR merged by moz-wptsync-bot
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
Regressions: 1739079

Beyond the regression above, maybe the fix didn't really fix it as it should have.

If you open the test-case, double-click the first word (select), hold and move to the far right, only select will stay selected*, but all the text should be selected.

In Fx 52, before the original regression, this doesn't happen, the entire phrase is selected as expected. The same in Vivaldi (Chromium-based).

*: this is inconsistent. Sometimes all the text is selected, but it usually doesn't go further than the first word.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: