Page MenuHomePhabricator

Font formatting keyboard shortcuts are shown in Visual Editor on mobile devices
Closed, ResolvedPublic

Description

While working on T201547, I took a close look at the various UI elements and noticed that the font formatting keyboard shortcuts are shown in Visual Editor on mobile devices.

Shortcuts like Ctrl-B, Ctrl-U, etc., are not quite relevant when using the on-screen keyboard. They are, however, relevant when using a physical keyboard, often connected using Bluetooth. I tested it on Samsung Galaxy S7 with Android 8 and Samsung Galaxy Tab 10.1 with Android 5, and somewhat surprisingly the shortcuts actually work.

The shortcuts are not really getting in the way, because their appearance is grey and subdued, although perhaps removing them if they are not needed can save some screen space.

If it's possible on mobile devices to detect that a physical keyboard is being used, then maybe these shortcuts can be shown only when the physical keyboard is used.

Event Timeline

Amire80 created this task.Sep 6 2018, 12:31 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 6 2018, 12:31 PM
Amire80 updated the task description. (Show Details)Sep 6 2018, 12:33 PM

If it's possible on mobile devices to detect that a physical keyboard is being used

It isn't.

Adding to 'it isn't'. Two further reading resources:

  1. CSS media feature only providing device specific feedback via browser on keyboard-only controls vs smartphones/touch screens vs basic stylus digitizers vs mouse(?) https://www.w3.org/TR/mediaqueries-4/#mf-interaction
  2. https://stackoverflow.com/questions/13270659/detect-virtual-keyboard-vs-hardware-keyboard

Ad 1., it would be interesting to see how reliable the detection is, and if for example, in a keyboard-only environment, pointer: none; holds true. But there is no reasonably manageable way to detect keyboard+ environments on this way…

Thanks for the replies.

As I said, it's not a thing that gets in the way very badly. More like a thing that came up as part of exploratory testing I'm doing with @iamjessklein, and that is hopefully interesting for the designers to think about.

@Amire80 And thanks for sharing. Given the technical restrictions, I'd propose to put this task on 'declined' and pick it up again if, ahem, mediaqueries-5 module provides such possibility?!

More like "stalled" maybe? :)

But it's not really important. As long as it's in the back of your minds somewhere...

Deskana triaged this task as Low priority.Sep 11 2018, 6:57 PM
Deskana added a subscriber: Deskana.

I feel like removing them outright might be the best decision, but that's not something to focus on right now.

Deskana moved this task from To Triage to Freezer on the VisualEditor board.Sep 11 2018, 6:57 PM
Volker_E changed the task status from Open to Stalled.Sep 11 2018, 7:47 PM

@Deskana To repeat once more, in a technically perfect world we would be able to have handles to differentiate between hardware-keyboard featuring devices and no-keyboard devices, but we don't have the handles (yet).

@Deskana To repeat once more, in a technically perfect world we would be able to have handles to differentiate between hardware-keyboard featuring devices and no-keyboard devices, but we don't have the handles (yet).

Yes, that was actually my point—I think the shortcuts should probably not be shown until such time that those handles exist, rather than showing them as is presently being done. But, I don't want to focus on this right now.

matmarex claimed this task.Sep 17 2018, 8:03 PM
matmarex edited projects, added VisualEditor (Current work); removed VisualEditor.
matmarex added a subscriber: matmarex.

While working on another task, I have just accidentally discovered that they are already supposed to be hidden:

modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.less
/* Hide toolbar shortcuts, no use on mobile */
.oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel {
	display: none;
}

This code was originally added in MobileFrontend in 2015 in commit rEMFRc2caf631dee2: Use simplified toolbar for VE now that it handles back/save itself, then moved to VE in rEMFRb8702a8d00c7: Move more code to VE/rEVEDd2c15e9eb534: Bring in code from MobileFrontend.

Unfortunately this doesn't work because the selector needs to be .oo-ui-popupToolGroup-tools rather than .oo-ui-popupToolGroup. This is caused by a change in OOUI (T192505) and probably should have been fixed in rEVEDe1635fdc5225: Update custom styles for format menu after OOUI changes, where we updated other similar selectors.

Looks like everyone here also agrees that they should be hidden. Since fix is trivial, I will just go ahead and do it.

Change 460968 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.init.mw.MobileArticleTarget: Fix keyboard shortcuts to be hidden

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

matmarex changed the task status from Stalled to Open.Sep 17 2018, 8:23 PM

@matmarex The point was that it should be hidden on non-keyboard devices, not on mobile (when f.e. you connect a hardware keyboard)!

@Deskana To repeat once more, in a technically perfect world we would be able to have handles to differentiate between hardware-keyboard featuring devices and no-keyboard devices, but we don't have the handles (yet).

matmarex added a comment.EditedSep 17 2018, 9:40 PM

Right, but we can't really detect that right now. And I'm not sure if detecting a hardware keyboard is even helpful. My Windows tablet with no hardware keyboard can display an on-screen keyboard that has a Ctrl key, and I've successfully used it many times to trigger keyboard shortcuts. What now?

It seems sensible to display the shortcuts on desktop view, which is usually accessed with devices on which you can easily trigger them, and hide them on mobile view, which is usually accessed with devices on which you can't. And it seems we've already arrived at this conclusion in 2015, and only broke this behavior recently by accident.


Perhaps we could hide the keyboard shortcuts on mobile view by default, but display them after the user attempts to use them (triggers one of the shortcuts, or just presses the Ctrl key)?

Change 460968 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ve.init.mw.MobileArticleTarget: Fix keyboard shortcuts to be hidden

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

matmarex updated the task description. (Show Details)Sep 18 2018, 7:31 PM
Deskana closed this task as Resolved.Sep 28 2018, 3:24 PM
Deskana awarded a token.