salesforce / salesforce/design-system-react
Datepicker: datepicker jumps when opened in a small viewport
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 982
- Forks
- 440
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
When rendered as a portal element menuPosition="overflowBoundaryElement" and display area is small, we observe jumpy behavior when opening datapicker by clicking on the calendar icon.


We believe it is caused by https://github.com/salesforce/design-system-react/blob/030b978cd74f582d71b6bc0c35e15e12922b002e/components/date-picker/date-picker.jsx#L557
when it is trying to focus on the dateCell, browser unnecessarily scrolls and results in the jumpy behavior.
Our proposed fix is setting preventScroll to true, this.selectedDateCell.focus({preventScroll: true});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components/date-picker/date-picker.jsx around line 557, where the selected date cell is focused when the datepicker opens. Reproduce the issue with menuPosition="overflowBoundaryElement" in a small display area, then verify that opening the calendar no longer causes the viewport or portal to jump.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100