Closed Bug 1433463 Opened 3 years ago Closed 3 years ago
Driver:Element Send Keys should not run unfocussing steps
59 bytes, text/x-review-board-request
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 Steps to reproduce: Let's suppose we have an input and perform two sendKeys commands in a sequence: element.sendKeys("a"); element.sendKeys("b"); It fires the following chain of events: focus keydown keypress keyup change blur focus keydown keypress keyup change blur But according to the specification, it should not unfocus the input element between commands and should fire: focus keydown keypress keyup keydown keypress keyup and only the next command that moves the focus should cause change and blur events. Here is the cite from IRC chat with Simon Stewart: https://botbot.me/freenode/selenium/2018-01-26/?msg=96179433&page=2 <barancev> simonstewart: AutomatedTester: should focus be moved out of an input field after sendKeys command? <barancev> I mean, *immediately* after sendKeys, as a part of this command execution flow <simonstewart> barancev: focus should stay where it is, unless the last key pressed is to move the focus out of the element (like "tab"). I think. Lemme check the spec <simonstewart> The spec's pretty clear that the unfocusing steps are not run <simonstewart> https://w3c.github.io/webdriver/webdriver-spec.html#element-send-keys <simonstewart> Step 9 is the one that sets the focus, but only if the element isn't already focused <simonstewart> And nothing after that unsets the focus <simonstewart> sendKeys won't fire the blur event <simonstewart> But if you click, that changes the active element <simonstewart> And that will cause a blur event to fire <simonstewart> (that is, you need to move focus, just as you would with a real browser)
Should be a regression from bug 1432864.
Seems to be a regression issue, it used to be spec conformant yesterday.
I would say the specification is inconsistent on this topic, as other interaction commands such as Element Clear do run the unfocussing steps. I would expect a high-level command to either unfocus or return focus to the previous focus area and the low-level action commands to not alter focus in any way. Filed https://github.com/w3c/webdriver/issues/1212 to clarify this.
Summary: sendKeys should not perform unfocusing steps → WebDriver:ElementSendKeys should not run unfocussing steps
OS: Unspecified → All
Hardware: Unspecified → All
Andreas, so this is a regression in Firefox 59 now. Should we consider to revert the behavior for now to not cause trouble for people? Not sure how many will be affected, but I don't see that we might reach a consensus on the spec issue until 59 gets released. What do you think?
(In reply to Henrik Skupin (:whimboo) from comment #4) > Andreas, so this is a regression in Firefox 59 now. Well it’s not a regression if it is the correct behaviour (-: > Should we consider to revert the behavior for now to not cause > trouble for people? Not sure how many will be affected, but I > don't see that we might reach a consensus on the spec issue until > 59 gets released. What do you think? I have pinged :automatedtester again on https://github.com/w3c/webdriver/issues/1212.
So the conclusion from https://github.com/w3c/webdriver/issues/1212 is that Element Clear _should_ run unfocussing steps, whereas Element Send keys _should not_, for historical reasons.
Comment on attachment 8953025 [details] Bug 1433463 - WebDriver:ElementSendKeys should not run unfocussing steps. https://reviewboard.mozilla.org/r/222302/#review228194
Attachment #8953025 - Flags: review?(dburns) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/042d7adef0bd WebDriver:ElementSendKeys should not run unfocussing steps. r=automatedtester
Created web-platform-tests PR https://github.com/w3c/web-platform-tests/pull/9631 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR merged
Sheriffs: Can we try uplifting this to beta? If it doesn’t apply, let me know and I can rebase it.
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.