New issue
Advanced search Search tips
Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

hterm: enable "alt-backspace-is-meta-backspace" may cause delete key broken

Reported by johnl...@gmail.com, Mar 23 2017

Issue description

UserAgent: Mozilla/5.0 (X11; CrOS x86_64 8872.76.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.105 Safari/537.36
Platform: 55.2.56 (Developer Build - neverware) developer-build chromeover64

Steps to reproduce the problem:
1. Enable "alt-backspace-is-meta-backspace" in the profile settings.
2. Open up a Secure Shell and connect.
3. Type something and use "delete" key to delete them, and it's working.
4. Use "alt + tab" to switch to other window, and then switch back to Secure Shell.
5. Repeat step 3 and find out "delete" key is broken.
6. Press "alt" once and repeat step 3, it's working again.

What is the expected behavior?
In step 5, "delete" key should work.

What went wrong?
In step 5, "delete" key behave just like I press "alt + backspace".

WebStore page: https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo?hl=zh-TW

Did this work before? N/A 

Chrome version: 55.0.2883.105  Channel: n/a
OS Version: 8872.76.0
Flash Version: 20170214.1.999.999

I checked the source code of libapps/hterm. The root cause of this problem is that the "blur" event was not handled properly. I guess the handler "hterm.Keyboard.prototype.onBlur_" is to handle situation like "alt + tab". However, the event never happen. Therefore, "hterm.Keyboard.KeyMap.prototype.onKeyDel_" will send '\x1b\x7f' instead of '\x1b[3~'.

If I was correct above, I would like to submit a patch to fix this problem. Thanks.
 

Comment 1 by johnl...@gmail.com, Mar 24 2017

The submitted patch is at https://chromium-review.googlesource.com/c/459236

Comment 2 by vapier@chromium.org, Mar 24 2017

Components: -Platform>Apps Platform>Apps>Default>Hterm

Comment 3 by vapier@chromium.org, Apr 12 2017

Owner: vapier@chromium.org
Status: Started (was: Unconfirmed)
posted a diff fix at https://chromium-review.googlesource.com/475471

Comment 4 by vapier@chromium.org, Apr 17 2017

Status: Fixed (was: Started)
this is fixed in hterm-1.62+ and nassh-0.8.36.2+
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 17 2017

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

commit c527161735d4970cecff1d4461dea5cec8eb27f7
Author: Mike Frysinger <vapier@chromium.org>
Date: Mon Apr 17 17:14:28 2017

hterm: fix alt key tracking

We track the status of the alt key to so we can undo some keyboard
shortcuts (like "alt-backspace-is-meta-backspace" for Chrome OS).
In order to track alt+tab (which normally changes windows), we use
the blur event.  This ends up not working because:
- the blur event does not bubble
- we set the listener on the body element
- the x-screen element is the one that has focus

Thus when we switch away, the blur event fires for x-screen only
and we never see it.  This manifests as the alt key being "stuck":
- enable alt-backspace-is-meta-backspace
- type some text in a bash shell prompt
- alt+tab to a different window
- alt+tab back to Secure Shell
- try pressing the delete key and see it act as alt+backspace

Instead, let's use the focusout event to track the focus state.
This event bubbles, so the body element is properly notified.

BUG= chromium:704468 

Change-Id: I7990c6e8e7c7a70e052deaf41f72ebb05c46c692
Reviewed-on: https://chromium-review.googlesource.com/475471
Reviewed-by: Brandon Gilmore <varz@google.com>
Reviewed-by: Rob Ginda <rginda@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/c527161735d4970cecff1d4461dea5cec8eb27f7/hterm/js/hterm_keyboard.js

Status: Verified (was: Fixed)

Sign in to add a comment