mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.11k stars 1.27k forks source link

[pickers] disable autofocus to start when selecting end-range #13550

Closed roybarash closed 2 months ago

roybarash commented 3 months ago

The problem in depth

Hello,

I want to stop DateRangeCalendar from jumping to start/end of the range after a selection. Basicly, I would like the calendar to stay where it was before the selection ended and prevent the auto-focus on the new selection.

For example: when you select a start date from 3 month ago, then select today as the end date, it will jump back to the start position.

I saw that you supply the prop disableAutoMonthSwitching but it either not matching my case or it has some issues with DateRangeCalendar. It didn't work for me.

I might should point out that the component is controlled.

I would really appreciate your help with this. Thanks

Your environment

`npx @mui/envinfo` ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: disableAutoMonthSwitching, jump Order ID: 91552

michelengelen commented 3 months ago

@LukasTy I remember we had a similar request not too lonmg ago, but cannot find the issue atm. Do you remember?

arthurbalduini commented 3 months ago

Hello @roybarash, indeed the disableAutoMonthSwitching prop will not fit the use case you described. Currently, it only prevents month switching after re-selecting a start date with an already set end date. I will raise this issue so we can discuss it internally and get back to you ASAP. 🙂

LukasTy commented 2 months ago

@roybarash, have you tried using controlled rangePosition to achieve this behavior? 🤔 Here is an example idea.

github-actions[bot] commented 2 months ago

The issue has been inactive for 7 days and has been automatically closed.