Closed Bug 1698705 Opened 3 years ago Closed 3 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


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

60 Branch



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


(Reporter: tustamido, Assigned: emilio)




(Keywords: regression)


(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:

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

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

Pushed by
Fix bogus block-frame check in GetRangeForFrame. r=saschanaz
Created web-platform-tests PR for changes under testing/web-platform/tests

(In reply to Alice0775 White from comment #2)

Regression window:

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
Closed: 3 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.