Divec has uploaded a new change for review.

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

Change subject: WIP: Zero-width space to avoid empty annotation cursoring bug
......................................................................

WIP: Zero-width space to avoid empty annotation cursoring bug

Add zero-width space to make span-like tags non-empty, so that the browser won't
merge their cursoring positions with the following character.

ve.ce.MWNumberedExternalLinkNode:
* Insert U+200B ZERO WIDTH SPACE inside span (before 'a' tag).

TODO:
- Check other nodes with empty annotation tags
- Fix getNodeAndOffset (though it's already broken for 
MWNumberedExternalLinkNodes)
- More bidi testing

Bug: T96307
Change-Id: Ib07f732043eae4640e3dcfdc06015bcf8897c7b4
---
M modules/ve-mw/ce/nodes/ve.ce.MWNumberedExternalLinkNode.js
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/55/208355/1

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWNumberedExternalLinkNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWNumberedExternalLinkNode.js
index dd96b6d..88c57c3 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWNumberedExternalLinkNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWNumberedExternalLinkNode.js
@@ -26,7 +26,14 @@
        this.$element
                .addClass( 've-ce-mwNumberedExternalLinkNode' )
                // Need CE=false to prevent selection issues
-               .prop( 'contentEditable', 'false' );
+               .prop( 'contentEditable', 'false' )
+               // Need some content to make span take up a cursor position, 
but it must be text
+               // with no directionality, else it can break Chromium cursoring 
(see
+               // https://code.google.com/p/chromium/issues/detail?id=441056 
). Either a
+               // unicorn-like img tag or the actual apparent link text 
("[1]", hitherto shown
+               // with CSS generated content) would fall foul of this bug. Use 
a zero-width
+               // space so it doesn't change the appearance.
+               .text( '\u200B' );
 
        // Add link
        this.$link = $( '<a>' )

-- 
To view, visit https://gerrit.wikimedia.org/r/208355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib07f732043eae4640e3dcfdc06015bcf8897c7b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <da...@sheetmusic.org.uk>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to