Page MenuHomePhabricator

Double-clicking the first word in a topic selects not only the word but the heading on Firefox
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue:

  • Open a discussion page, e.g. WP:VPT, on Firefox
  • Double-click the first word in the first paragraph of a section

What happens?:
The heading gets selected in addition to the clicked word.

What should have happened instead?:
Only the word gets selected.

Other information:
The culprit appears to be this commit for T317135 (which ironically is about a Chromium bug). If you remove position: absolute; from span[data-mw-comment-start] (or set it to anything other than absolute or fixed), the bug goes away.

Event Timeline

Well, that's silly. If you find a way to fix this without breaking T317135, I'll be happy to merge a patch.

(By the way, the issue only occurs when you disable "Show discussion activity" in preferences, or on pages where it's not available, like in the Wikipedia: namespace.)

Are you sure this is a DiscussionTools problem? I can't replicate on WP:VPT in Firefox 109 with DT turned on, which Matma Rex seems to think it will be a problem on that page. :) (Double clicking gets me the word and the space after, which is expected behavior.)

Check safe mode, and check that your mouse clicker hasn't decided to fail.

Are you sure this is a DiscussionTools problem?

100%. As I said, it goes away if you remove or tinker with <span data-mw-comment-start="" id="..."></span>.

Reproducible with Firefox 109 on Windows 11 22H2, when logged out (private mode), in safe mode, or with JavaScript off. Same unexpected behavior with long tap with Firefox 109 on Android 13. DMacks reported the same for macOS (which @Xaosflux confirmed). Also reproducible with Minerva, where it selects the invisible label "Edit" instead of the heading.

Double clicking gets me the word and the space after, which is expected behavior.

That's configurable in layout.word_select.eat_space_to_next_word in about:config, but doesn't seem to affect the behavior in question.

Ahhhhh clicking the wrong thing (first word in the header). Yup, I can repro now too.

Is T317135 still a thing? I can reproduce the Chromium bug by opening data:text/html,<u><span style="position: relative; top: -1em;"></span>hello</u> directly but not by restoring span[data-mw-comment-start] { position: relative; top: -1em; }.

Otherwise, how about something like:

span[data-mw-comment-start] {
	display: inline-block;
	vertical-align: top;
	margin-top: -1em;
}

Is T317135 still a thing? I can reproduce the Chromium bug by opening data:text/html,<u><span style="position: relative; top: -1em;"></span>hello</u> directly but not by restoring span[data-mw-comment-start] { position: relative; top: -1em; }.

It seems to be broken in a more complicated way now. I can reproduce the original issue only after saving a reply using the reply tool first (or otherwise on HTML elements dynamically added to the page, e.g. from the browser developer tools). They also didn't close my bug report (https://bugs.chromium.org/p/chromium/issues/detail?id=1359501).

Otherwise, how about something like:

span[data-mw-comment-start] {
	display: inline-block;
	vertical-align: top;
	margin-top: -1em;
}

I tried this out; unfortunately display: inline-block causes the element to take up space in some cases, and this would cause issues similar to T305721.

matmarex changed the task status from Open to Stalled.Jun 22 2023, 7:29 AM

I can't reproduce this any more in Firefox 115. Could anyone confirm?

Tacsipacsi changed the task status from Stalled to Open.Jun 22 2023, 3:33 PM
Tacsipacsi added a subscriber: Tacsipacsi.

I can still reproduce it in Firefox 115.0b8 (as well as 102.12.0esr). It’s broken only if there is no floating box (no image, no {{tracked}} etc.) at the top of the section, for example in https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Tech_News:_2023-25. It’s reproducible even if the first word is a link, although it’s not easy to double-click-select it instead of navigating to it.

You're right, I must have been "lucky" and only tested sections with floating boxes. I swear I tried several times in different sections.

although it’s not easy to double-click-select it instead of navigating to it.

On Firefox (at least on Windows), you can hold Alt to select text in links without following them, it works with double-clicking too :)

although it’s not easy to double-click-select it instead of navigating to it.

On Firefox (at least on Windows), you can hold Alt to select text in links without following them, it works with double-clicking too :)

.... til

On Firefox (at least on Windows), you can hold Alt to select text in links without following them, it works with double-clicking too :)

Nice! On my Debian+Cinnamon, the window manager stole a bunch of unusual combinations involving Alt, including Alt+click, so instead of selecting a word, it started moving the whole Firefox window. It has caused issues in an IDE previously, but I’ve never took my time to find and disable this setting. Now I did, and the Firefox text selection works, thanks for pushing me to do it! :) Unfortunately I no longer remember which IDE it was, so I can’t try that again…