mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.19k stars 1.52k forks source link

ElementSendKeys calls scrollIntoView when an element is already visible #2183

Closed andrewnicols closed 4 months ago

andrewnicols commented 4 months ago

System

I don't currently have a testcase for this because I'm not sure how best to demonstrate this.

https://www.w3.org/TR/webdriver2/#element-send-keys states:

NOTE The Element Send Keys command scrolls into view the form control element and then sends the provided keys to the element. In case the element is not keyboard-interactable, an element not interactable error is returned.

The scroll into view definition states:

To scroll into view an element perform the following steps only if the element is not already in view:

(emphasis mine)

The issue is that the Marionette interaction.sys.mjs::webdriverSendKeysToElement always calls lazy.dom.scrollIntoView(containerEl); and that always calls scrollIntoView().

That is to say that Marionette always scrolls into view, regardless of whether it is necessary or not.

whimboo commented 4 months ago

Thanks @andrewnicols! Given that this is actually an issue with Marionette would you mind filing a new bug on Bugzilla under the Remote Protocol / Marionette component?

andrewnicols commented 4 months ago

Ah apologies - I forget what has to be reported where.

Reported to Marionette: https://bugzilla.mozilla.org/show_bug.cgi?id=1906095

whimboo commented 4 months ago

This issue is now fixed thanks to @andrewnicols's work and will be available in the next Firefox Nightly build today.