Page MenuHomePhabricator

In Chromium, cursoring jumps over references and some extra characters
Closed, ResolvedPublic8 Estimated 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 raised the priority of this task from to Needs Triage.
Ijon updated the task description. (Show Details)
Ijon subscribed.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript
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 Medium 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.

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).

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 Medium.

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

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.

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

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