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.