Skip to content

Key events involving the control key don't work as expected #17146

Closed

Description

@paulrouget

We realized that no keybindings on Windows work (the "reload"/Ctrl-R binding doesn't work for example).

This is because Glutin sends 2 things:

  • the character matching the keyboard layout (ReceivedCharacter(ch))
  • the key code and modifiers (KeyboardInput)

But the character that is sent when the Ctrl key is pressed is a different unicode character.
For exemple, Ctrl-L will send the "Form Feed" \u{c} character, not L.

A possible approach is to map the key code to the character. This is what is done in the DOM code here:

Cow::from(match key {

But this is wrong because the event's key property is not localized.

Another approach is to map the combo unicode character to its original key. For example:

'\u{c}' => 'l',
'\u{12}' => 'r',
…

Both the ports/glutin/window.rs and components/script/dom/keyboardevent.rs need this.

Activity

  1. added
    C-assigned
    on Jun 3, 2017
  2. jklepatch commented on Jun 3, 2017

    @jklepatch
    Contributor

    I am working on this

  3. atouchet commented on Jun 3, 2017

    @atouchet
    Contributor

    Is #16459 related to this issue?

  4. paulrouget commented on Jun 4, 2017

    @paulrouget
    ContributorAuthor

    Is #16459 related to this issue?

    Very likely, yes.

  5. added
    P-windows
    and removed
    C-assigned
    on Nov 15, 2017
  6. atouchet commented on Mar 14, 2018

    @atouchet
    Contributor

    @paulrouget do you know what the current situation is regarding this issue? As far as I can tell control key input still isn't working properly after the Glutin update.

  7. paulrouget commented on Mar 14, 2018

    @paulrouget
    ContributorAuthor

    We need to investigate see if that needs to be fixed in glutin or in servo.

  8. added a commit that references this issue on Mar 22, 2018
  9. added 3 commits that reference this issue on Jul 30, 2018
    9c7891c
    1bd34e7
    9790f87
  10. atouchet commented on Jul 31, 2018

    @atouchet
    Contributor

    @paulrouget I've been testing your PR for this and it works somewhat but there are still some definite issues. On first launch using Ctrl + L to open the URL dialog works consistently but subsequent attempts at doing this (ex. load servo.org homepage -> press Ctrl + L to navigate to new page -> press Ctrl + L again to navigate to another new page) do not bring up the dialog again. It seems to work only once and then rarely or not at all afterwards. Should I file a new issue for this behaviour?

    Edit: It's actually easier than that to reproduce. You can just exit the dialog box after bringing it up with Ctrl + L and you won't be able to bring up back up again easily.

    Edit 2: I've now been able to bring up the URL dialog without even pressing Ctrl and L at the same time at one point. There's definitely something off here.

  11. paulrouget commented on Jul 31, 2018

    @paulrouget
    ContributorAuthor

    Should I file a new issue for this behaviour?

    Yes please.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inputP-windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions