Closed Bug 1603964 Opened 4 years ago Closed 4 years ago

Triple click selection breaks at inline-block boundaries

Categories

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

73 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla74
Tracking Status
firefox74 --- verified

People

(Reporter: sidvishnoi, Assigned: emilio)

References

(Regressed 1 open bug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

Steps to reproduce:

Input:

<p><code>oops</code> triple click me to select this sentence <code>hey!</code>.</p>
<style>code { display: inline-block; }</style>
  • Triple click the "triple click me to select this sentence" part.

Actual results:

  • Triple clicking selected/highlighted only "triple click me to select this sentence" part, and skipped "oops" and "hey!".

See for a minimal example: https://codepen.io/sidvishnoi/pen/zYxKRKK
Platform: Linux x64 (Ubuntu)

  • Firefox 73 (Nightly), Firefox 71: doesn't select "oops", "hey".
  • Chrome 79: selects.

Expected results:

Entire paragraph should have been selected, regardless of code being inline or inline-block

Component: Untriaged → Layout: Block and Inline
Product: Firefox → Core

I think we should treat inline-blocks with a single line as inlines. Thoughts Mats?

Status: UNCONFIRMED → NEW
Component: Layout: Block and Inline → DOM: Selection
Ever confirmed: true

That seems reasonable. The behavior in Chrome is a bit more subtle actually. Modifying the test to <code>oops<br>last</code> it seems that Chrome extends the selection to include "last" but not "oops". Likewise, triple-clicking "last" works the same, but triple-clicking "oops" selects just that line inside the inline-block. (Adding vertical-align:top make no difference, which is a bit more debatable whether it makes sense or not.)
But yeah, including single-line inline-blocks as you suggest seems like a good first step.

For the record, changing the last inline-block to <code>hey!<br>again</code> shows that Chrome includes "hey!" but not "again". I.e. the opposite of how it works on the start side. I guess not supporting multi-range selection makes it impossible for them to select "again" without also selecting "hey!".

Is there any arguments for why we simply shouldn't include the whole inline-block even if it's multiple lines? It's clearly part of the line it's displayed on, so I can't think of a good reason for Chrome's behavior.

If you move the inline-block to the middle of the line, then Chrome stops the selection there. That behavior seems weird to me.

The only weird thing that comes to mind is what line to select when you triple-click in an inline-block with multiple lines... If you only account single-line inline-blocks then the answer seems straight-forward but... I don't feel very strongly either way.

Priority: -- → P3
See Also: → 1612236
Assignee: nobody → emilio
Attached file Testcase #1
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/476a32323adb
Only treat block-level frames as line-breaks in paragraph selection code. r=mats
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Regressions: 1615142
Flags: qe-verify+

Reproduced the issue with Firefox 73.0a1 (20191214215837) using STR from comment 0 and test case from comment 9 on Windows 10x64.
The issue is verified fixed with Firefox 74.0b4 (20200216164042) on Windows 10x64, macOS 10.15 and Ubuntu 16.04.

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

Attachment

General

Created:
Updated:
Size: