Bug 125393
| Summary: | Don't dispatch blur/focus events if the element's page is not focused | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> |
| Component: | UI Events | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, mmaxfield, rreno, sam, syoichi, vitor.roriz, webkit-bug-importer |
| Priority: | P2 | Keywords: | BlinkMergeCandidate, InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ryosuke Niwa
Consider merging https://chromium.googlesource.com/chromium/blink/+/60ed87d48e7c337cada58f2ae25da4d9eb426207
When the page loses focus a blur event is dispatched once, prevent a second dispatch (via e.g. programmatic blur()-ing), when a page doesn't have focus, prevent a focus event dispatch (via e.g. programmatic focus()-ing), as it will receive a focus event when the page regains focus.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ryosuke Niwa
Got reverted in http://src.chromium.org/viewvc/blink?view=revision&revision=160140.
But the concept of the change seems correct.
Also see https://code.google.com/p/chromium/issues/detail?id=276757
Ahmad Saleem
It landed in this commit:
https://src.chromium.org/viewvc/blink?view=revision&revision=164069
I took a test case from the above and changed it into JSFiddle:
https://jsfiddle.net/8ueL62kx/
*** Firefox Nightly 105 ***
Load test, it would be focused in input field but no event is fired and then click any where besides "input" field, it will fire "blur" event.
*** Chrome Canary 106 ***
Load test, it would be focused in input field but no event is fired and then click any where besides "input" field, it will fire "blurfocus" event.
*** Safari Technology Preview 151 ***
Load test, it would be focused in input field but no event is fired and then click any where besides "input" field, it will fire "blurfocus" event.
_______
I am not sure on web-spec or whether something else is required but just going to share what I tested or observed. Thanks!
Radar WebKit Bug Importer
<rdar://problem/99045743>
Ahmad Saleem
I tried to land this change in following PR based Comment 03 - commit of Chromium:
Link - https://github.com/WebKit/WebKit/pull/4774
and these are learnings:
1) Fixing Developer Tools test case is easy and can be followed from Chromium patch without any issue.
2) Someone need to update "TestRunner" - testRunner.focusWebView part to accommodate this change to ensure that the focus work properly since it leads to 77 API failures on iOS:
https://ews-build.webkit.org/#/builders/9/builds/81789
____
Since it is beyond my capability to update (2), I will leave it for someone else to fix this bug but will document my attempt for others. Thanks!