Page MenuHomePhabricator

In Chromium, cursoring jumps over references and some extra characters
Closed, ResolvedPublic8 Story Points

Description

wikitext: Foo <ref>bar</ref> baz.

It is impossible to select the reference by cursoring left/right.

Interestingly this isn't a problem with other inline focusables (comment, <math>)

Original report:

(Chrome 47.0.2526.106 (64-bit) on Linux)

Editing a page (in English, no RTL characters on the page) on Officewiki, I placed my cursor just to the right of a footnote reference, and pressed the left-arrow key. It skipped past the footnote reference and the immediately-preceding period (.), whereas I was expecting it to skip the footnote reference and rest to the right of the period.

I.e. whereas the text was:

blah blah blah.[2]

I expected the cursor to move from:

blah blah blah.[2]|

to

blah blah blah.|[2]

but it moved to:

blah blah blah|.[2]

The page in question (not a secret, but not specifying it here as a matter of principle) is my most recently edited page on Officewiki, as of this writing.

Event Timeline

Ijon created this task.Jan 14 2016, 1:04 AM
Ijon raised the priority of this task from to Needs Triage.
Ijon updated the task description. (Show Details)
Ijon added a subscriber: Ijon.
Restricted Application added a project: VisualEditor. · View Herald TranscriptJan 14 2016, 1:04 AM
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript
Jdforrester-WMF triaged this task as Normal priority.Feb 2 2016, 8:08 PM
Jdforrester-WMF moved this task from To Triage to TR3: Language support on the VisualEditor board.
Jdforrester-WMF set Security to None.
Jdforrester-WMF edited a custom field.
Jdforrester-WMF renamed this task from pressing left-arrow key, cursor skips period past footnote reference. to Cursoring jumps over references; pressing left-arrow key, cursor skips period past footnote reference.Feb 16 2016, 8:23 PM
Jdforrester-WMF raised the priority of this task from Normal to High.
Jdforrester-WMF added subscribers: DLynch, dchan, Esanders.
Esanders renamed this task from Cursoring jumps over references; pressing left-arrow key, cursor skips period past footnote reference to Cursoring jumps over references and some extra characters.Feb 17 2016, 3:10 PM
Esanders updated the task description. (Show Details)

Possibly related: T119838 for the cursor requiring two presses to get past a mwEntity.

Elitre added a subscriber: Elitre.Mar 12 2016, 11:02 AM

So, I looked at this. Simplified HTML DOM in CE is:

<p id="…" class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode">
	Foo.
	<span about="#mwt10" class="mw-ref ve-ce-leafNode ve-ce-focusableNode ve-ce-mwReferenceNode" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" contenteditable="false">
		<a href="#" style="counter-reset: mw-Ref 1;">
			<span class="mw-reflink-text">[1]</span>
		</a>
	</span>
	Bar!
</p>

I think the problem is the inner <span> with class="mw-reflink-text"; this class does display:none; and then applies the CSS counter styling. Removing the display:none; causes the reference the appear twice ([1][1]), but the cursoring works perfectly. Is there a way we can cause the inner span to not affect cursoring?

Change 280683 had a related patch set uploaded (by Jforrester):
[Failing test case] Cursoring over empty alienInline nodes

https://gerrit.wikimedia.org/r/280683

This is broken in a slightly different way now. In Chrome cursoring right works, but left it skins over the reference without selecting it (after two keypresses).

Izno moved this task from Unsorted backlog to External on the Cite board.Jun 24 2016, 3:54 PM
dchan renamed this task from Cursoring jumps over references and some extra characters to In Chromium, cursoring jumps over references and some extra characters.Aug 4 2016, 8:48 PM
dchan lowered the priority of this task from High to Normal.
dchan added a comment.Aug 4 2016, 8:58 PM

This seems to be a problem due to Chromium's position normalization interacting badly with its ce=false handling (similar to https://bugs.chromium.org/p/chromium/issues/detail?id=440877 ).

Change 303008 had a related patch set uploaded (by Divec):
WIP: Hide text without confusing Chromium's cursoring

https://gerrit.wikimedia.org/r/303008

dchan added a comment.Aug 4 2016, 10:30 PM

Change 303008 just changes display:none to font-size:0 . In theory this could have an impact on bidi cursoring in some browser. Therefore I have tested references at bidi text offsets as shown below:

Eng <ref>11</ref> lish? English<ref>22</ref> English!

עבר <ref>33</ref> ית? עברית<ref>44</ref> עברית!
<div lang="he" dir="rtl">
Eng <ref>55</ref> lish? English<ref>66</ref> English!

עבר <ref>77</ref> ית? עברית<ref>88</ref> עברית!

עבר<ref>99</ref>ית

(Note the bidi text rendering above is misleading). The cases are:

  1. LTR directionality in LTR block, not adjacent to a directional character
  2. LTR directionality in LTR block, adjacent to a directional word-end character
  3. RTL directionality in LTR block, not adjacent to a directional character
  4. RTL directionality in LTR block, adjacent to a directional word-end character
  1. LTR directionality in RTL block, not adjacent to a directional character
  2. LTR directionality in RTL block, adjacent to a directional word-end character
  3. RTL directionality in RTL block, not adjacent to a directional character
  4. RTL directionality in RTL block, adjacent to a directional word-end character
  1. Adjacent to strongly directional RTL characters on both sides.

In Chromium 50:

  • On master, all cases fail (i.e. you cannot cursor onto any of the references)
  • On 303008, cases 4 and 6 fail.

In Firefox 46:

  • On master, cases 4 and 6 fail.
  • On 303008, cases 4 and 6 fail (i.e. no change).

So it doesn't seem that this change has any adverse impact on bidi cursoring.

Jdforrester-WMF closed this task as Resolved.Aug 8 2016, 10:53 PM
Jdforrester-WMF assigned this task to dchan.

Change 303008 merged by jenkins-bot:
Hide text without confusing Chromium's cursoring

https://gerrit.wikimedia.org/r/303008