fix(date-picker): anchor the calendar popover to the whole field - #221
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DatePickerandDateRangePickerpositioned their calendar against the calendar icon button instead of the field. The button sits at the end of the field, so with the defaultalign="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
Selectplaces its list under the whole trigger.Closes #218
Type of change
Changes
DatePicker,DateRangePicker: pass the existing field root element as the popover anchor. One line per component.dev(19px and 82px off) and passes with the fix.CHANGELOG.mdentry under[Unreleased].Checklist
Closes #…)pnpm checkpasses (0 errors, 0 warnings)pnpm lintpassespnpm testpassesCHANGELOG.mdunder[Unreleased]*.types.ts, Material 3 design tokens)Screenshots / notes
Verified in Chromium against
dev, opening every enabled picker on/date-picker,/date-range-pickerand a two-column repro page (70 pickers):dev.dev.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.