Page MenuHomePhabricator

Unable to type grave accents in VE with Catalan IME (by pressing backtick before a letter)
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Use Visual Editor
  • Press the grave accent "`" key

What happens?:

  • A <code></code> block is generated.

What should have happened instead?:

  • The grave accent should be input

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Event Timeline

According to the documentation (https://www.mediawiki.org/wiki/Help:VisualEditor/User_guide) the keyboard shortcut for "code block" should be CTRL-SHIFT-6. Also there is no mention of this in the other keyboard shortcuts documentation at https://www.mediawiki.org/wiki/VisualEditor/Portal/Keyboard_shortcuts.

src/ui/ve.ui.TriggerRegistry.js says this should be C-S-6

This was done fairly recently in c79dcf48f622f0d4ac5541636b584330946270c5.

@Esanders my understanding is that on a mac you can press option+` to be in "accent mode", where the accent will be applied to the next character you type. I tried this, and in VE that currently applies the trigger. Unless there's a way of having pressing the bare backtick key also enter that mode, I think we could avoid the issue entirely by adjusting that trigger to ignore option-modified keypresses. (This is probably a good idea on macOS anyway, as option+keypress is widely used to trigger alternate characters.)

src/ui/ve.ui.TriggerRegistry.js says this should be C-S-6

Just to explain, this is a sequence so you'd need to check out src/ui/ve.ui.SequenceRegistry.js instead.

@Xaosflux to confirm, you're doing this on a mac? Are you pressing option+`, or do some keyboard-languages make it so that pressing the bare backtick is sufficient to enter that mode?

@DLynch I'm doing this on a PC, and simply pressing the "`" key at all with no modifiers is generating the unexpected <code>..</code> block. There does not seem to be any intuitive way to type the backtick at all following that change, other than jumping to the source editor? I can certainly sympathize with users that have constructed characters, as missing the modifier key now leaves them in an unexpected code block.

This seems to have introduced an undocumented easteregg, when CTRL-SHIFT-6 was already present and documented for this shortcut.

Xaosflux renamed this task from Unable to type grave accents in visual editor to Unable to type grave accents (backtick) in visual editor.Mar 28 2022, 9:50 AM

It should be in the help dialog. If there is a conflict with a common IME feature we can just remove this feature.

@Xaosflux do you type the backtick after the letter or before? If it is always after we could restrict this sequence to only trigger when you type whitespace + backtick.

I can reproduce the problem with typing accented characters like "ò" when using Ubuntu 20.04 with the "Catalan (Spain, with middle-dot L)" keyboard layout. It does not occur when using Windows 10 with the "Calalan (Spanish keyboard)" keyboard layout. I don't have access to a Mac to test there. I'll record my screen later to demonstrate.

This is not related to the behavior in English, which was an intentional change (and where you can type "`" by pressing Ctrl+Z to undo the automatic formatting – this doesn't work to fix Catalan input).

Change 774397 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@master] Revert "Add backtick sequence for <code> formatting"

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

Change 774397 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Revert "Add backtick sequence for <code> formatting"

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

In English, this character isn't used as often as in other languages, but nonetheless it is something we may expect our editors to type, for example we have articles such as:

*https://en.wikipedia.org/wiki/Halema%CA%BBuma%CA%BBu

It is also used in romanization/transliteration of arabic (e.g. ( يوم الأربعاء ) --> yaum al-arba`a' )

Additionally in a large project like the English Wikipedia, we come upon people quote from lots of external sources, sometimes with the wrong quote marks - it is generally better for them to accidentally create 'text like this' instead of "text like this" as opposed to being thrown in to an unexpected <code> block.

@Xaosflux Both of these examples are actually different letters (ayin and ʻokina), and it is incorrect to use the grave accent to represent them (https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style#Apostrophes).

@matmarex - oops, bad cirrus results when I quickly searched for some; nonetheless - given the choices of a novice editor inserting the wrong sort of apostrophe vs an unexpected code block, the former seems preferable.

The latter seems preferable to me, as it is much easier to notice and fix. Anyway, this is a bug about Catalan…

Change 774491 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (dbcb897f2)

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

Change 774492 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Disable backtick sequence in ve-mw while conflict with Catalan is investigated

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

The user story I raised is that a standard keyboard key was unexpectedly taken over. (Unexpected to end users, even those that read through the published documentation). While I agree it is 'easy' for experienced editors to notice something odd is going on, it isn't necessarily easy for novice users (a primary audience for visual editor); as far as easy to fix, I would not say having to know to press CTRL-Z is intuitive either. That there is more impact for languages that used keyboard composition is an additional issue.

Change 774491 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (dbcb897f2)

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

Change 774400 had a related patch set uploaded (by Bartosz Dziewoński; author: Esanders):

[mediawiki/extensions/VisualEditor@wmf/1.39.0-wmf.4] Disable backtick sequence in ve-mw while conflict with Catalan is investigated

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

Change 774492 abandoned by Bartosz Dziewoński:

[mediawiki/extensions/VisualEditor@master] Disable backtick sequence in ve-mw while conflict with Catalan is investigated

Reason:

Not needed on master after https://gerrit.wikimedia.org/r/774491 (which reverts the code), but I'll use this for the backport, since it's easier.

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

I can reproduce the problem with typing accented characters like "ò" when using Ubuntu 20.04 with the "Catalan (Spain, with middle-dot L)" keyboard layout. It does not occur when using Windows 10 with the "Calalan (Spanish keyboard)" keyboard layout. I don't have access to a Mac to test there. I'll record my screen later to demonstrate.

Videos for future reference:

These show me typing "Viquipèdia" using Catalan keyboard layouts, pressing the ` key (next to P in that layout) before pressing E, in visual and then in wikitext editor.

On Ubuntu, as soon as I press `, the character is inserted, and VisualEditor thinks the user typed the lone accent and performs the conversion.

On Windows, when I press `, nothing initially happens, but the next character inserted gains the accent when it is typed. The lone accent is never inserted, and VisualEditor doesn't get confused.

I had a look with our event logger, and it seems like there are compositionstart and compositionend events during the typing of <grave>+letter.

@dchan I wonder if we can disable sequences during IME composition?

It looks like it's heavily keyboard-layout dependent whether the ` key is a dead key without any modifiers or not, which makes this a bit of a pain.

An alternative to the compositionstart/compositionend events is the event.isComposing on keydown. It's not supported in IE, so it'd have to wait for IE11 support being dropped... but it's a simpler flow to understand in-code. (The composition events seem to have been added in IE11, which I assume is why we weren't already using them -- or they're wildly inconsistent when coming from IMEs, I haven't looked into it.)

Change 774400 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@wmf/1.39.0-wmf.4] Disable backtick sequence in ve-mw while conflict with Catalan is investigated

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

Mentioned in SAL (#wikimedia-operations) [2022-03-28T20:34:40Z] <urbanecm@deploy1002> Synchronized php-1.39.0-wmf.4/extensions/VisualEditor/modules/ve-mw/ui/ve.ui.MWSequenceRegistry.js: f32ae21f2456b69d615c0d63fc12cff097ba3e31: Disable backtick sequence in ve-mw while conflict with Catalan is investigated (T304804) (duration: 00m 57s)

matmarex edited projects, added Editing QA; removed Patch-For-Review.

This should be fixed on all wikis now.

Change 775439 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@REL1_38] Revert "Add backtick sequence for <code> formatting"

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

Change 775439 merged by jenkins-bot:

[VisualEditor/VisualEditor@REL1_38] Revert "Add backtick sequence for <code> formatting"

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

Change 775864 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@REL1_38] Update VE core submodule to REL1_38

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

Change 775864 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_38] Update VE core submodule to REL1_38

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

Esanders renamed this task from Unable to type grave accents (backtick) in visual editor to Unable to type grave accents in VE with Catalan IME (by pressing backtick before a letter).Mar 31 2022, 4:40 PM

While that was a specific example (Catalan IME) - my user story was about the problem in general - in that this unexpected keyboard easteregg was introduced.