Skip to content

fix(date-picker): anchor the calendar popover to the whole field - #221

Merged
ndlabdev merged 2 commits into
devfrom
fix/218-picker-popover-anchor
Sep 18, 2026
Merged

ndlabdev merged 2 commits into
devfrom
fix/218-picker-popover-anchor

Conversation

@ndlabdev

Copy link
Copy Markdown
Owner

Summary

DatePicker and DateRangePicker positioned their calendar against the calendar icon button instead of the field. The button sits at the end of the field, so with the default align="start" the popover opened at the icon's left edge: 220 to 418px right of the field on the docs pages, and over the neighbouring column in a two-column grid.

The popover is now anchored to the field root. It opens flush under the field's left edge, the same way Select places its list under the whole trigger.

Closes #218

Type of change

  • 🐛 Bug fix
  • ✨ New feature / component
  • 📖 Documentation
  • ♻️ Refactor / chore
  • ⚠️ Breaking change

Changes

  • DatePicker, DateRangePicker: pass the existing field root element as the popover anchor. One line per component.
  • One regression test per component, written in the existing specs without fixture files. It opens the calendar and asserts the popover's left edge matches the field's left edge within 1px, while the trigger sits more than 100px to the right. It fails on dev (19px and 82px off) and passes with the fix.
  • CHANGELOG.md entry under [Unreleased].

Checklist

  • Linked the related issue (Closes #…)
  • pnpm check passes (0 errors, 0 warnings)
  • pnpm lint passes
  • pnpm test passes
  • Added or updated tests for the change
  • Updated CHANGELOG.md under [Unreleased]
  • Followed component conventions (no comments outside *.types.ts, Material 3 design tokens)

Screenshots / notes

Verified in Chromium against dev, opening every enabled picker on /date-picker, /date-range-picker and a two-column repro page (70 pickers):

  • Left edge flush with the field: 59 of 70 with the fix, 0 of 70 on dev.
  • The other 11 are 544px wide popovers in the right column. Starting at the field would overflow the viewport, so they shift left to keep the 8px collision padding, exactly as on dev.
  • Popover width, side and gap to the field are unchanged for all 70. No console errors.

Behaviour of align:

  • start: now flush with the field's left edge (was offset by the field width minus the icon).
  • center: now centred on the field instead of the icon.
  • end: unchanged, since the icon already sat at the field's right edge.

Only verified in Chromium.

DatePicker and DateRangePicker positioned their calendar against the
calendar icon button, which sits at the end of the field. With the
default align="start" the popover opened at the icon's left edge,
hundreds of pixels right of the field and over neighbouring content.

The popover is now anchored to the field root, so it opens flush under
the field's left edge, matching how Select places its list.
align="center" now centres on the field and align="end" is unchanged.

Closes #218
@ndlabdev ndlabdev added the bug Something isn't working label Sep 17, 2026
@ndlabdev ndlabdev self-assigned this Sep 17, 2026
@ndlabdev
ndlabdev merged commit 963ac33 into dev Sep 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant