Phenomenon
When a page with a contenteditable element becomes hidden (tab switch, minimize), the Page Visibility API may affect editing state. Focus may be lost, and composition may be interrupted.
Reproduction example
- Create a contenteditable div with active composition (IME).
- Switch to another tab or minimize the window.
- Switch back to the original tab.
- Observe whether composition continues or is interrupted.
- Check if focus is maintained.
Observed behavior
- In Safari on macOS, tab switches may interrupt composition.
- Focus may be lost when the page becomes hidden.
- Composition state may not be preserved.
- Editing may be disrupted.
Expected behavior
- Composition should pause gracefully when the page is hidden.
- Focus should be restored when the page becomes visible.
- Editing state should be preserved across visibility changes.