w3c / w3c/webdriver

Element Send Keys always resets shift key for lowercase letters

Open
#1,322 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Element Send Keys
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

While implementing Element Send Keys to use the action primitives in Marionette I noticed a misbehavior in how modifier keys are handled. Especially here the Shift key.

Take the following example:

elem.send_keys("ab" + Keys.SHIFT + "cd" + Keys.SHIFT + "ef")

This produced a value of abCDef for the element. But this combination doesn't work with the spec anymore because of chapter 14. Element Interaction, section 14.3 Element Send Keys:

If char is not a shifted character and the shifted state of keyboard is true, create a new action object with keyboard's id, "key", and "keyUp", and set its value property to U+E008 ("left shift"). Dispatch a keyUp action with this action object and keyboard's key input state.

That means that we always reset the shift key status now, when a lowercase letter is send. And that even with the shift key just activated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Element Send Keys behavior described in the WebDriver specification's section 14.3, and compare the Shift-state rules with the reported ab + Shift + cd + Shift + ef example. Done means the specification and related behavior no longer reset Shift unexpectedly for lowercase letters, with the example producing the intended result.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.