added 3 commits
November 17, 2025 06:56
brandyscarney
changed the title
fix(date-time): ensure date time is shown when intersection observer fails to report visibility
fix(datetime): ensure date time is shown when intersection observer fails to report visibility
brandyscarney
changed the title
fix(datetime): ensure date time is shown when intersection observer fails to report visibility
fix(datetime): ensure datetime is shown when intersection observer fails to report visibility
Merged
2 tasks
pull Bot pushed a commit to goldtoad6/ionic-framework that referenced this pull request
May 1, 2026…class on initial entry (ionic-team#31108) Issue number: internal --------- ## What is the current behavior? `ion-datetime` runs two IntersectionObservers: one to detect when the host becomes visible (which adds `datetime-ready`) and one to detect when it becomes hidden (which removes the class and tears down listeners). When the host mounts offscreen, both observers receive an initial "not intersecting" entry on `observe()`. The hidden-state observer treats that initial entry as a real visible-to-hidden transition, queues a `writeTask` to remove `datetime-ready`, and races the layout-based fallback (`ensureReadyIfVisible`) that adds the class after 100ms. On WebKit the remove wins often enough that the e2e test for the fallback (added in ionic-team#30793 to fix ionic-team#30706) had to be skipped on Mobile Safari. Anything in production that adds `datetime-ready` outside of a real `isIntersecting: true` event is exposed to the same race. ## What is the new behavior? A `hasBeenIntersecting` flag is set true only when `visibleCallback` observes `isIntersecting: true`. The hidden-state observer's teardown is gated on this flag, so the synthetic initial "not intersecting" entry is ignored. The flag is reset when the host actually transitions to hidden and on `disconnectedCallback`. The previously duplicated init-listeners + ready-class block is consolidated into a single `markReady` helper. The WebKit skip on the IO-fallback e2e test has been removed. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If yes, please describe the impact and migration path for existing applications below. --> ## Other information The asymmetry where `ensureReadyIfVisible` (the layout fallback) deliberately does NOT set `hasBeenIntersecting` is load-bearing: the flag must reflect a real observer signal, not a fallback-driven write, otherwise the bug returns. This is called out at the guard site so future cleanups don't undo it. This test was most likely to fail in docker testing Linux Webkit with `--repeat-each=20` because it was pretty flaky. I was able to force it to fail under these conditions and, after fixing it, it no longer failed. ## Relevant Preview Link: - https://ionic-framework-git-fw-7284-ionic1.vercel.app/src/components/datetime/test/basic