Problem with double click selection in rows
Categories
(Core :: DOM: Selection, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox101 | --- | affected |
People
(Reporter: aminomancer, Unassigned)
Details
Attachments
(1 file)
|
695.85 KB,
image/webp
|
Details |
I'm not really sure what the issue is, but if you look at source code on Searchfox or diffs on Phabricator, there's an issue when double clicking to select text and then dragging across multiple lines/rows. I'll attach a recording to show what it looks like. Basically the line/row you first clicked gets completely and permanently selected when you move the cursor to another line and then back. This also happens if you extend the selection with shift + arrow keys too. And if you copy and paste the selection, there's a spurious newline character in the selection!
What they have in common, I guess, is row-like elements. I can't say much more than that since they're divs with display: flex on Searchfox, and table rows on Phabricator. As I'm typing this (here on Bugzilla), the "Possible Duplicates" display that shows up under the Summary field is a table with similar rows. And if I repeat this in that table, I get the same results. The characters trailing my selection in the row I double clicked get permanently selected after I drag the cursor down to the next row and then back up to the first row. If I drag the cursor up to the previous row, then the characters leading the selection get permanently selected.
STR
- Click this link
- On line 7, double click (and hold) on any of the characters in
#include
Your selection should look likeinclude - With the left mouse button held down, move your cursor down to line 8, without changing its horizontal position
- Your selection should look like this now:
include "TextControlState.h"
#include
- Now, still holding down the LMB, move your cursor back up to line 7, where it was previously — on the characters in
#include - Your selection should look like this now:
include "TextControlState.h"
- Copy your selection by hitting Accel+C
- Paste it in a text editor
- Your pasted text should say:
include
"TextControlState.h"
Expected
- This selection should instead return to just
include - The pasted text of course should be the same, just
include. But that aside, there also shouldn't be a newline character in the pasted text, since there certainly isn't one in the copied text.
By the way, I gave Searchfox as an example, but I repeated the full steps on Phabricator and Bugzilla too. Oddly, the copy+paste issue also occurs on Bugzilla, but I didn't see it on Phabricator, even though the selection issue that seems to be connected to the copy+paste issue does occur on Phabricator.
The newline character always seems to get inserted directly after the original double-click selection. So, in the example I gave, it comes after include because that's the string we first selected by double-clicking. Here on Bugzilla, you can double click the firefox101 string in the Tracking Flags section above, and drag down and back up, and then copy paste. And you'll get this:
firefox101
--- affected
| Reporter | ||
Comment 1•3 years ago
|
||
I didn't show the copy+paste issue in this recording, but the copy+paste issue wouldn't have occasion to happen if the selection properly returned to its former state when the cursor returns to its former location.
Comment 2•3 years ago
|
||
I can't reproduce this with the mouse, but at least on Phabricator I can reproduce it when extending the selection with the keyboard. If I double-click to select a word in a diff, and then extend the selection with Shift+arrow key to beyond the end of the line, then I can't move the selection back to before the end of the line.
Note: Phabricator uses a table, but it might be handling selection itself in script, because selecting beyond the end of a cell should extend the selection to the first cell on the next row (if you select something in the right pane of a diff, normal selection would move to the left pane of the diff), but that doesn't happen here.
| Reporter | ||
Comment 3•2 years ago
|
||
Are you able to reproduce it on Searchfox?
https://searchfox.org/mozilla-central/rev/0c2945ad4769e2d4428c72e6ddd78d60eb920394/browser/locales/en-US/browser/newtab/asrouter.ftl#247
- Double click (and hold)
Backin the beginning of the highlighted string, so that onlyBackis selected - With mouse held down, drag down one row so mouse is over
buttonin the next row's string - The selection should have changed to:
Back up your data to make sure you don’t lose important info like bookmarks and passwords –– especially if you switch to a new device.
device-migration-fxa-spotlight-primary-button
- With mouse still held down, drag up one row so mouse is over
Backagain - Copy the selection - your clipboard should now have:
Back
up your data to make sure you don’t lose important info like bookmarks and passwords –– especially if you switch to a new device.
- There's an erroneous newline, and no way to get the selection back to how it started, with just
Backselected
Description
•