Phenomenon
When an IntersectionObserver is used to detect when a contenteditable element becomes visible or hidden, the observer may not fire correctly during editing. Changes to content size or position during editing may not trigger intersection updates as expected.
Reproduction example
- Create a contenteditable div that can scroll in and out of view.
- Attach an IntersectionObserver to detect visibility.
- Edit content that changes the elementโs size.
- Scroll the contenteditable in and out of view.
- Observe whether intersection callbacks fire correctly.
Observed behavior
- In Safari on macOS, IntersectionObserver may not update correctly during editing.
- Content size changes may not trigger intersection recalculations.
- Visibility detection may be delayed or incorrect.
- The observer may miss rapid content changes.
Expected behavior
- IntersectionObserver should work correctly with contenteditable.
- Content changes should trigger intersection recalculations.
- Visibility detection should be accurate and timely.