playwright/packages/playwright-core
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
..
bin fix: proper chrome-beta channel installation on MacOS (#11973) 2022-02-09 11:28:51 -08:00
bundles feat(plugins): expose suite to plugin setup (#13807) 2022-04-28 08:16:17 -07:00
src fix: page.locator.focus() and page.locator(…).type(…) (#14267) 2022-05-19 14:31:56 -07:00
types chore: fix wrong toHaveScreenshot defaults in docs (#14200) 2022-05-16 22:26:23 +03:00
.npmignore chore: babel, expect, zip bundles (#13588) 2022-04-18 11:31:58 -07:00
browsers.json feat(chromium-tip-of-tree): roll Chromium TOT to 1008 (#14279) 2022-05-19 09:29:44 -07:00
cli.js chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
index.d.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
index.js chore: use utils via index export (4) (#13404) 2022-04-07 14:36:13 -07:00
index.mjs fix: export request from index.jsm (#13158) 2022-03-30 09:35:47 -07:00
package.json chore: cut v1.22.0 (#14098) 2022-05-12 11:12:01 -07:00
README.md chore: drop dependency on playwright-core in all our packages (#2318) 2020-05-21 13:18:15 -07:00
ThirdPartyNotices.txt chore: bundle pwt deps (#13622) 2022-04-18 21:47:18 -07:00

playwright-core

This package contains the no-browser flavor of Playwright.