Skip to content

fix(datetime): improve range selection behavior and styling - #31759

Merged
OS-susmitabhowmik merged 17 commits into
nextfrom
ROU-13222-update-datepicker-range
Nov 20, 2026
Merged

OS-susmitabhowmik merged 17 commits into
nextfrom
ROU-13222-update-datepicker-range

Conversation

@OS-susmitabhowmik

@OS-susmitabhowmik OS-susmitabhowmik commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Issue number: resolves internal


What is the current behavior?

  • Range selection tap behavior: After selecting a full range (start + end), tapping a new date extends or modifies the existing range instead of starting a new one.
  • Range track sub-pixel seams: On screens with a fractional device pixel ratio (e.g. 2.625× on Pixel 9), faint 1px lines appear at every column boundary in the range track. Each day drew its own piece of the track with a ::before, and the per-cell boundaries left visible seams.
  • Range track z-index: The range track from the next row paints over the start/end day circles because all wrappers share the same stacking level.
  • Min/max bounds not enforced on programmatic values: Setting a range value where start or end falls outside min/max renders those out-of-bounds dates as highlighted.

What is the new behavior?

  • Third tap resets: Design feedback asked that a third tap start a new range, matching Material's range picker. Once a full range is selected, the next tap always starts a new range.
  • One bar per week: The first range day of each run within a week now draws the track for the whole run via --range-track-span, eliminating seams between days. The grid uses isolation: isolate as a single stacking context, replacing the per-wrapper z-index: 0.
  • Z-index fix: The grid's isolation: isolate keeps every track behind every day button, so the circles stay clear without per-wrapper elevation. Only the focused day is lifted (z-index: 1) so its focus ring isn't covered by the following day's button. Wrappers that draw the track (calendar-day-wrapper-range-track) are excluded to avoid elevating the wide ::before over adjacent day numbers.
  • Min/max clamping: Programmatic range values are clamped to min/max bounds. If the entire range falls outside bounds, the selection is cleared.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Manual test page

Range test page

New min/max scenarios added:

  • Start Before Min — start set before min, end within bounds → start clamped to min
  • End After Max — start within bounds, end set after max → end clamped to max
  • Range Entirely Outside — entire range outside min/max bounds → selection cleared

OS-susmitabhowmik and others added 5 commits November 16, 2026 12:25
Once a full date range is selected (start + end), the next tap now
always starts a new range instead of modifying the existing one.
This aligns with Material and OutSystems UI Date Picker behavior.

Resolves ROU-13222
- Add horizontal grid padding and --range-track-edge-overflow to the
  ionic theme so the range track bridges across week boundaries,
  matching the ios and md themes.
- Lift range-start and range-end wrappers to z-index: 1 so their
  circles are not covered by the next row's range track when they
  overflow their grid cell.
When a date range is set programmatically with start/end dates outside
the min/max constraints, clamp the range to the valid bounds. If the
entire range falls outside min/max, clear the selection entirely.

Resolves ROU-13214
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Nov 19, 2026 8:53pm UTC

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Nov 17, 2026
When the second tap in a range selection is earlier than the first,
swap start and end so the range renders correctly.
Consolidate duplicate "entirely before/after" e2e tests into one,
update test page with start-before-min, end-after-max, and
entirely-outside cases, and add ionChange console logger.
@OS-susmitabhowmik
OS-susmitabhowmik marked this pull request as ready for review November 17, 2026 20:41
@OS-susmitabhowmik
OS-susmitabhowmik requested a review from a team as a code owner November 17, 2026 20:41

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes on the description:

  • The description doesn't say why the tap behavior is changing. Could you add the reason, such as design feedback asking that a third tap start a new range, matching Material's range picker? If the swap is dropped (refer to the inline comment), the "Range order not normalized" bullets can go too, since next already treats an earlier second tap as a new start.
  • The out-of-bounds console warning already existed (warnIfValueOutOfBounds), so it isn't new behavior.

… range

The previous same-day check after clamping missed ranges that touch min
or max boundaries. Compare the original start/end against bounds first
so a range ending exactly on min is kept and a single-date range outside
bounds is correctly cleared.
…el seams

Each day in a range previously drew its own piece of the track with a
::before using two background layers. At fractional device pixel ratios
(e.g. 2.625× on Pixel 9), the browser anti-aliased each layer's edge
independently, letting the white background layer show through at every
column boundary.

The first range day of each run within a week now draws the track for
the whole run via --range-track-span, so there are no edges between
days. The track uses a single background color instead of two layers,
which means both opaque and translucent --range-background values work
without overlap artifacts.

The grid uses isolation: isolate as a single stacking context, replacing
the per-wrapper z-index rules. The ionic grid padding and edge overflow
are removed so the grid matches the design.
Add back focus-within (z-index: 2) and range-start/range-end (z-index: 1)
rules, excluding range-track wrappers whose wide ::before would cover
adjacent day numbers if elevated.

Also change range selection so tapping an earlier date as the second
click starts a new range instead of swapping, matching Material's range
picker. The focus screenshot now targets day 17 (adjacent to range-end)
to catch focus ring clipping.
# Conflicts:
#	core/src/components/datetime/test/show-adjacent-days/datetime.e2e.ts-snapshots/datetime-show-adjacent-days-display-ionic-md-ltr-light-Mobile-Firefox-linux.png
#	core/src/components/datetime/test/show-adjacent-days/datetime.e2e.ts-snapshots/datetime-show-adjacent-days-weekends-disabled-ionic-md-ltr-light-Mobile-Firefox-linux.png

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the z-index rule is dropped, the "Z-index fix" bullet in the description needs the same update: the grid's isolation: isolate keeps the circles clear, and only the focused day is lifted.

Remove the separate z-index: 1 rule for range-start/range-end
wrappers since calendar-day-wrapper-range-end is no longer rendered
and every range-start with a track is also a range-track wrapper.
Demote the focus-within rule back to z-index: 1 since there is no
competing layer to stay above.

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OS-susmitabhowmik
OS-susmitabhowmik merged commit 7ffb6e9 into next Nov 20, 2026
110 of 115 checks passed
@OS-susmitabhowmik
OS-susmitabhowmik deleted the ROU-13222-update-datepicker-range branch November 20, 2026 01:11

This branch was successfully deployed

1 active deployment
Preview — ac31fdeb Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants