playwright/packages/playwright-core/src
Ross Wollman fbb364c1cd
fix: page.locator.focus() and page.locator(…).type(…) (#14267)
Fixes focus and blur management when `page.locator(…).focus()`  and  `page.locator(…).type(…)` are used which was regressed by 7a5b070 (#13510).

#13510 relied on an implicit assumption that this (conditional) [`blur`](7a5b070e95/packages/playwright-core/src/server/injected/injectedScript.ts (L672)) call would always be followed by a call that resulted in a newly focused element via this [`focus`](7a5b070e95/packages/playwright-core/src/server/injected/injectedScript.ts (L674)) call.

However, some elements are [not focusable](https://html.spec.whatwg.org/multipage/interaction.html#focusable-area), so we were blurring incorrectly, and losing focus that we should have maintained.

Two regression tests were added that pass on the commit prior to 7a5b070e95 (and match manual testing/expectations):

* `page.locator(…).focus()`: _keeps focus on element when attempting to focus a non-focusable element_
* `page.locator(…).type(…)`: _should type repeatedly in input in shadow dom_

Additionally, a third test (_should type repeatedly in input in shadow dom_) was added to check the invariant from #13510 that states:

> This affects [contenteditable] elements, but not input elements.

and allows us to introduce the targeted fix (contenteditble check before blur) without breaking FF again.

And _should type repeatedly in contenteditable in shadow dom with nested elements_ was added to ensure the above fix works with nest contenteditble detection.

Fixes #14254.
2022-05-19 14:31:56 -07:00
..
cli chore: make bundles typed (#13620) 2022-04-18 17:50:25 -07:00
client fix(toHaveProperty): serialize falsy arguments as well (#14232) 2022-05-17 14:44:12 -07:00
common chore: make tests pass on Node.js 17+ (#13678) 2022-04-22 13:42:52 +02:00
grid chore: bundle core deps (#13621) 2022-04-18 20:20:49 -07:00
protocol chore: serialize circular objects (#14045) 2022-05-09 18:51:53 -07:00
remote chore: bundle core deps (#13621) 2022-04-18 20:20:49 -07:00
server fix: page.locator.focus() and page.locator(…).type(…) (#14267) 2022-05-19 14:31:56 -07:00
third_party chore: bundle pixelmatch, it has not changed for 2 years (#13585) 2022-04-15 16:58:31 -07:00
utils fix: delete headers with undefined value (#13880) 2022-05-02 12:38:57 -07:00
browserServerImpl.ts test: switch temp dir tests to use userDataDir (#13745) 2022-04-26 09:32:58 +01:00
DEPS.list chore: move to folder-based deps lists (#13361) 2022-04-06 14:40:19 -07:00
inprocess.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
inProcessFactory.ts chore: move registry & dispatchers to under server (#13370) 2022-04-06 22:21:27 -07:00
outofprocess.ts chore: use utils via index export (5) (#13413) 2022-04-07 20:18:22 -07:00
utilsBundle.ts feat(plugins): expose suite to plugin setup (#13807) 2022-04-28 08:16:17 -07:00
zipBundle.ts chore: make bundles typed (#13620) 2022-04-18 17:50:25 -07:00