Skip to content

fix(datetime): re-emit wheel ionScrollStart/ionScrollEnd from picker columns - #30674

Open
vunizhona wants to merge 2 commits into
ionic-team:mainfrom
vunizhona:feat/datetime-wheel-scroll-events-30449
Open

fix(datetime): re-emit wheel ionScrollStart/ionScrollEnd from picker columns#30674
vunizhona wants to merge 2 commits into
ionic-team:mainfrom
vunizhona:feat/datetime-wheel-scroll-events-30449

Conversation

@vunizhona

Copy link
Copy Markdown
Contributor

Issue number: resolves #30449


What is the current behavior?

Wheel scrolling inside ion-datetime does not provide host-level lifecycle events for app code to react to start/end of scrolling.

What is the new behavior?

  • ion-datetime re-emits wheel scroll lifecycle events from inner columns:
    • ionScrollStart when any wheel column begins scrolling.
    • ionScrollEnd once all active columns settle, coalesced with a 300ms debounce.
    • Events do not bubble to avoid duplicate handling; they are emitted on the host.
  • ion-picker-column emits ionScrollStart and ionScrollEnd at scroll start/end.
  • API/types updated to expose the new events across frameworks (Angular/Vue proxies).

Does this introduce a breaking change?

  • Yes
  • No

Other information

  • core/src/components/datetime/datetime.tsx: capture-phase listeners, coalescing logic, new events
  • core/src/components/picker-column/picker-column.tsx: emits start/end at scroll boundaries
  • core/src/components/datetime/test/prefer-wheel/datetime.spec.ts: replace fake timers with explicit waits
  • core/api.txt, core/src/components.d.ts, Angular/Vue proxies: API surface/types for new events
  • Proxy changes are generated to reflect the new events(updated during the build).

Verification

  • Targeted specs: cd core && npm ci && npm run test.spec -- src/components/datetime/test/prefer-wheel/datetime.spec.ts (expect 3 passed).

  • Manual: cd core && npm start, open /src/components/datetime/test/prefer-wheel/index.html.

Scroll a wheel column: app receives one ionScrollStart at the beginning, one ionScrollEnd after settling.

vunizhona and others added 2 commits September 9, 2025 15:18
re-emit ionScrollStart/ionScrollEnd from wheel columns on ion-datetime by capturing inner ion-picker-column events and suppressing originals; coalesce multiple concurrent column scrolls into a single start/end with a 300ms end debounce
add ionScrollStart/ionScrollEnd to ion-picker-column and emit at scroll start/end
update API/types and Angular/Vue proxies to expose new events
stabilize prefer-wheel specs by replacing fake timers with real waits to avoid newSpecPage timeouts

closes ionic-team#30449
@vunizhona
vunizhona requested a review from a team as a code owner September 9, 2025 12:56
@vunizhona
vunizhona requested a review from ShaneK September 9, 2025 12:56
@vercel

vercel Bot commented Sep 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ionic-framework Ready Ready Preview Comment Sep 9, 2025 0:57am

@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package labels Sep 9, 2025
@gnbm gnbm changed the title feat(datetime): re-emit wheel ionScrollStart/ionScrollEnd from picker columns fix(datetime): re-emit wheel ionScrollStart/ionScrollEnd from picker columns Jul 28, 2026
pull Bot pushed a commit to Zezo-Ai/ionic-framework that referenced this pull request Aug 21, 2026
Issue number: resolves ionic-team#30449

---------

## What is the current behavior?

`ion-picker-column` commits the centered option on a 250ms idle timer
that only starts once the wheel stops moving. Flick a wheel and tap a
Save button while it's still coasting, and the click handler reads the
previous value. On an `ion-datetime` with `preferWheel`, the wheel shows
one date while `value` still reports another.

## What is the new behavior?

During a scroll the user started, the column watches for `pointerdown`
anywhere outside itself. On that press it halts the wheel on the option
under the highlight and commits it synchronously, so an application's
own click handler reads the value the user can see. A press on a sibling
wheel in the same picker is exempt, so reaching for the next column
leaves the first one coasting. The datetime wheel handlers now read the
working and active parts at event time, because an outside press settles
every coasting column in one synchronous dispatch and the previous
render-time reads clobbered each other.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

The community PR for this issue, ionic-team#30674, was a great attempt, but it
takes the reporter's other suggestion and adds public `ionScrollStart`
and `ionScrollEnd` events to `ion-picker-column` and `ion-datetime`. I
didn't go that way for two reasons. It's permanent public API on two
components plus the Angular and Vue proxies, carried by every consumer
forever, to work around a bug. More importantly it doesn't fix the stale
value: every app has to write the disable-Save logic itself, and its
`ionScrollEnd` is debounced 300ms after the wheel settles, so a tap
during the flick still reads the old value at the moment the click
handler runs. Committing on `pointerdown` fixes existing apps with no
code change. The scroll events are a fair feature request on their own,
just a separate one from this bug fix.

Preview:

- Picker column scroll:
[iOS](https://ionic-framework-git-fw-7706-ionic1.vercel.app/src/components/picker-column/test/scroll?ionic:mode=ios)
/
[MD](https://ionic-framework-git-fw-7706-ionic1.vercel.app/src/components/picker-column/test/scroll?ionic:mode=md)
- Datetime prefer-wheel:
[iOS](https://ionic-framework-git-fw-7706-ionic1.vercel.app/src/components/datetime/test/prefer-wheel?ionic:mode=ios)
/
[MD](https://ionic-framework-git-fw-7706-ionic1.vercel.app/src/components/datetime/test/prefer-wheel?ionic:mode=md)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ion-datetime and ion-picker-column do not emit reliable change or scroll events, causing stale values on Save

1 participant