Public bug reported:

[Impact]
Currently, users trying to use spice-html5 with international keyboards (like 
the Brazilian ABNT2) have problems typing. Some physical keys send the 
completely wrong output to the virtual machine console.

This happens because the javascript code is relying on the old keyCode
property from the browser. This property is very bad at translating non-
US keyboard layouts. For example, the keys /? and \| on the Brazilian
layout get mixed up with US keys because they share the same numeric ID
in the browser.

The fix updates the library to use the modern KeyboardEvent.code
property instead, which reads the real physical key location before the
browser tries to translate it.

[Test Plan]
- Have an environment with spice-html5 configured (like OpenStack Horizon).
- Open a virtual machine console in the web browser.
- Configure your local client machine to use an international keyboard layout 
(like pt-BR ABNT2).
- Inside the console, press the keys that don't exist on standard US keyboards, 
like /? (next to right shift) and \| (next to left shift).
- Without the patch, the console will receive the wrong scancode and type the 
wrong character.
- With the patch applied, the guest OS will receive the correct scancode and 
type the characters normally.

[Where problems could occur]
The risk of regressions here might be if any of the new mappings in the code 
dictionary are wrong. If a string is mapped to the wrong scancode, a key that 
was working fine before could start sending the wrong input.

However, the risk is very low because the developer kept the old keyCode
behavior working as a fallback in the code. If the browser doesn't send
a valid e.code, it just falls back to the old way. Also, our local usage
tests didn't show any issue with standard or international typing after
applying this.

[Other Info]
The patch is already merged upstream and it applies cleanly on top of the 
current Ubuntu package version.
Upstream commit: 
https://github.com/opensourcevdi/spice-html5/commit/9c8377f86c3423010e5705861429761074ed63e2

** Affects: spice-html5 (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  [Impact]
- 
- Currently, users trying to use spice-html5 with international keyboards
- (like the Brazilian ABNT2) have problems typing. Some physical keys send
- the completely wrong output to the virtual machine console.
+ Currently, users trying to use spice-html5 with international keyboards (like 
the Brazilian ABNT2) have problems typing. Some physical keys send the 
completely wrong output to the virtual machine console.
  
  This happens because the javascript code is relying on the old keyCode
  property from the browser. This property is very bad at translating non-
  US keyboard layouts. For example, the keys /? and \| on the Brazilian
  layout get mixed up with US keys because they share the same numeric ID
  in the browser.
  
  The fix updates the library to use the modern KeyboardEvent.code
  property instead, which reads the real physical key location before the
  browser tries to translate it.
  
  [Test Plan]
- 
  - Have an environment with spice-html5 configured (like OpenStack Horizon).
  - Open a virtual machine console in the web browser.
  - Configure your local client machine to use an international keyboard layout 
(like pt-BR ABNT2).
  - Inside the console, press the keys that don't exist on standard US 
keyboards, like /? (next to right shift) and \| (next to left shift).
  - Without the patch, the console will receive the wrong scancode and type the 
wrong character.
  - With the patch applied, the guest OS will receive the correct scancode and 
type the characters normally.
  
  [Where problems could occur]
  The risk of regressions here might be if any of the new mappings in the code 
dictionary are wrong. If a string is mapped to the wrong scancode, a key that 
was working fine before could start sending the wrong input.
  
  However, the risk is very low because the developer kept the old keyCode
  behavior working as a fallback in the code. If the browser doesn't send
  a valid e.code, it just falls back to the old way. Also, our local usage
  tests didn't show any issue with standard or international typing after
  applying this.
  
  [Other Info]
  The patch is already merged upstream and it applies cleanly on top of the 
current Ubuntu package version.
  Upstream commit: 
https://github.com/opensourcevdi/spice-html5/commit/9c8377f86c3423010e5705861429761074ed63e2

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2157521

Title:
  SRU: Fix international keyboard mapping

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/spice-html5/+bug/2157521/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to