New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 807513 link

Starred by 3 users

Issue metadata

Status: ExternalDependency
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

hterm: Pixelbook media keys are incorrectly handled for F2 - F6

Project Member Reported by derat@chromium.org, Jan 31 2018

Issue description

Google Chrome	63.0.3239.140 (Official Build) (64-bit)
Platform	10032.86.0 (Official Build) stable-channel eve

In Secure Shell 0.8.42.1 on an eve device with "Open as window" checked, the internal keyboard's Back key produces F1, but the Reload key in the F2 position instead produces F3. Presumably there's something that's unaware of the "updated" keyboard layout on eve (no Forward key and everything shifted right, Play/Pause key inserted between Brightness Up and Mute).

When I type Search+Reload, I get F2, so presumably things are working correctly within Chrome.

I'm not at all familiar with hterm, but the problem may be here: http://cs/chromeos_public/src/third_party/libapps/hterm/js/hterm_keyboard_keymap.js?l=349

If so, I have no idea how hterm can detect this.

Or maybe there's some other top-row-to-function conversion path in Chrome that needs to be updated.
 

Comment 1 by vapier@chromium.org, Jan 31 2018

Status: Available (was: Untriaged)
Summary: hterm: Pixelbook media keys do not handle F2+ (was: Secure Shell inserts F3 instead of F2 for Reload key on eve)
hterm's handling of media keys for Chromebooks matches standard Chrome OS keyboard layout:
 [Back] [Forward] [Reload] [Full] [Switch] ...
which we treat as:
 [F1]   [F2]      [F3]     [F4]   [F5] ...

but Pixelbook omits [Forward] which means we omit [F2].

https://chromium.googlesource.com/apps/libapps/+/hterm-1.78/hterm/js/hterm_keyboard_keymap.js#347

i don't think there's anyway in JS to detect the current board, only whether we're on CrOS and which architecture.
Summary: hterm: Pixelbook media keys are incorrectly handled for F2 - F6 (was: hterm: Pixelbook media keys do not handle F2+)
it was pointed out that Pixelbook also inserts a Play/Pause key between the brightness & volume buttons.  so "only" the middle keys are out of sync.

here's the full layouts (function keys/standard/pixelbook):
 [F1]   [F2]      [F3]     [F4]     [F5]         [F6]         [F7]        [F8]   [F9]      [F10]   [F11]
 [Back] [Forward] [Reload] [Full]   [Switch]     [BrightDown] [BrightUp]  [Mute] [VolDown] [VolUp] [Power]
 [Back] [Reload]  [Full]   [Switch] [BrightDown] [BrightUp]   [PlayPause] [Mute] [VolDown] [VolUp] [Settings]

i'll add some bindings for the new PlayPause button so at least F7 will work (and add the new settings button for F11).

but until something changes in Chrome/somewhere else, there isn't a lot hterm can do, so your only option is to add keybindings like:
{
  "168": "'\u001bOQ'",
  "183": "'\u001bOR'",
  "182": "'\u001bOS'",
  "216": "'\u001b[15~'",
  "217": "'\u001b[17~'"
}
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/a33f9975bb6c60b19f3daf1c3da26ec9626f3336

commit a33f9975bb6c60b19f3daf1c3da26ec9626f3336
Author: Mike Frysinger <vapier@chromium.org>
Date: Sat Mar 10 07:07:38 2018

hterm: add media key handling only for Chrome OS systems

We've been adding bindings to map media keys to function keys for
Chromebooks (because they have a known standard layout), but those
bindings don't make sense for other systems where the layout is
completely different.  Restrict these bindings to CrOS.

BUG=chromium:807513

Change-Id: I32d3f32846a7a050fc10d30ae93b052117cb25e9
Reviewed-on: https://chromium-review.googlesource.com/899453
Reviewed-by: Vitaliy Shipitsyn <vsh@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/a33f9975bb6c60b19f3daf1c3da26ec9626f3336/hterm/js/hterm_keyboard_keymap.js

Project Member

Comment 4 by bugdroid1@chromium.org, Mar 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/7a7207d729703081e78404427ff929703800f703

commit 7a7207d729703081e78404427ff929703800f703
Author: Mike Frysinger <vapier@chromium.org>
Date: Sat Mar 10 23:30:16 2018

hterm: cleanly handle Firefox keyboard deviations

For whatever reason, Firefox maps a few keys differently from
everyone else (Chrome/Safari/Opera/IE/Edge).  Set up constants
for them (since some actually conflict) so we only map the keys
for the browsers that work.

This also improves the handling of ;: on Firefox browsers.

BUG=chromium:807513

Change-Id: Ib10ae202128c5a25cf427523985f1e9d18d68625
Reviewed-on: https://chromium-review.googlesource.com/899454
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Vitaliy Shipitsyn <vsh@google.com>

[modify] https://crrev.com/7a7207d729703081e78404427ff929703800f703/hterm/js/hterm_keyboard_keymap.js

Project Member

Comment 5 by bugdroid1@chromium.org, Mar 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/95c9109a017a54bb046ddafc02454b592e56f608

commit 95c9109a017a54bb046ddafc02454b592e56f608
Author: Mike Frysinger <vapier@chromium.org>
Date: Tue Mar 13 22:21:33 2018

hterm: update Chromebook media bindings

Now that the clashing Firefox bindings have been isolated, we can
add bindings for the remaining Chrome OS mediakeys and flesh out
the top row.  Especially now that the volume keys can be captured
and processed.

It seems we can see the power button too now, but we just pass it
as we can't stop it.

On the Pixelbook (eve), the media keys are different: the forward
button is missing, and there's a new play/pause button.  So a few
of the keys are mapped incorrectly.  Fixing this will require more
thought.

We capture and eat the assistant key by default.  It doesn't seem
to be that useful for devs at the terminal, and they can always
add to their keybindings {"153":"PASS"} to keep it.  If it makes
more people unhappy, we can see about adding a dialog/preference.

BUG=chromium:807513

Change-Id: Ia97349b51a4f699c8bcfdaf497ba764483106ef3
Reviewed-on: https://chromium-review.googlesource.com/899455
Reviewed-by: Vitaliy Shipitsyn <vsh@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/95c9109a017a54bb046ddafc02454b592e56f608/hterm/js/hterm_keyboard_keymap.js

Comment 6 by vapier@chromium.org, Mar 13 2018

Status: ExternalDependency (was: Available)
so it's about as good as it's going to get currently for pixelbooks.  i don't have any way of (in hterm or Secure Shell) differentiating by active device or querying the top level set of keys to find their order.  which means the pixelbooks set of top keys are going to remain semi-broken/offset.  if you want to change your layout, see comment #2 with the keyboard mappings.

Sign in to add a comment