[Webkit-unassigned] [Bug 254882] New: iPadOS: window loses focus when dismissing the keyboard, breaks Page Lifecycle API
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Apr 2 02:02:57 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=254882
Bug ID: 254882
Summary: iPadOS: window loses focus when dismissing the
keyboard, breaks Page Lifecycle API
Product: WebKit
Version: Safari 16
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: UI Events
Assignee: webkit-unassigned at lists.webkit.org
Reporter: ik at rejh.nl
** Short description: **
On iPadOS, the window.blur event fires when the software keyboard is dismissed via the dedicated button (bottom right corner).
** Reproduce: **
1. On an iPad Mini (5th gen), open twitter log in and open a DM / chat
2. Connect with dev tools and paste the code below (logs focus and blur events to console)
2. Tap the message input at the bottom of the chat UI
3. Dismiss the keyboard using the dedicated button (bottom right corner)
The same steps can performed on this testcase I built for another issue (plz ignore the included steps ;))
https://testcase.rejh.nl/webkit-safe-area-inset-does-not-update/
** Code snippet: **
```
// Log focus and blur events to console
function log(eventName) {
return (event) => console.log(eventName, event.target === event.currentTarget, event.target);
}
window.addEventListener('focus', e => log('focus')(e));
window.addEventListener('blur', e => log('blur')(e));
```
** What happens: **
The window.blur event fires. This may be problematic for sites using the Page Lifecycle API (https://developer.chrome.com/blog/page-lifecycle-api/) to determine the state of the page.
- Scrolling the page does not restore focus
- AFAIK you can't do it programatically (window.focus() does not, in face, focus the window)
- Tapping somewhere in the page does restore focus.
** Additional notes: **
1. I have only been able to reproduce this on my iPad Mini. I don't have an actual iPhone to test with at the moment, but I have noticed that the 'Done' button on iPhone behaves differently from the button on iPadOS. iPhone and iPad simulator seem to behave as expected (no window.blur event).
2. It seems that there are a number of bugs related to the software keyboard, especially on iPadOS:
- iOS: safe-area-inset-bottom still set when keyboard is open: https://bugs.webkit.org/show_bug.cgi?id=217754
- iPadOS: viewport doesn't correctly restore when dismissing keyboard: https://bugs.webkit.org/show_bug.cgi?id=254861
Would be great to see this area getting some attention
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230402/494f0dce/attachment.htm>
More information about the webkit-unassigned
mailing list