Skip to content

[pickers][DateRangePicker] New option to open range picker by pressing end adornment (like other pickers) #5368

@acgrant

Description

@acgrant

Summary 💡

There was talk about a similar idea in mui/material-ui#24511 (comment) which pertained to the DatePicker. It would be nice to see this functionality in the the Pro Plan's DateRangePicker. I understand there is the disablePointerEvents prop which allows focus to shift; however, for accessibility purposes I believe that having the calendar pop up after clicking the calendar icon, like with the case of the DatePicker component, would be nice.

Examples 🌈

No response

Motivation 🔦

I was able to get close to the functionality by using the renderInput prop alongside two TextFields, each with InputProps and then the following:

 InputProps={{
           endAdornment: (
             <InputAdornment position='end'>
             <IconButton onClick={customFunctionThatOpensTheDateRangePicker} edge='end'>
                <DateRangeIcon />
               </IconButton>
            </InputAdornment>
          ),
 }}

It was pretty effective. I had to add a ClickAwayListener to address some things; however, I was fine. Then, I discovered that the mobile view buttons for "cancel" and "ok" were not responsive because I had overwritten the open prop on the DateRangePicker and thus (at least according to my current understanding) would have to account for all the other changes of state myself. That's when I realized how nice it would be for this to just be built in. I'm sure it comes with some unique challenges; however, if you can't see a concise workaround for me or if you feel it's worth it, I would be very appreciative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan: ProImpact at least one Pro userscope: pickersChanges or issues related to the pickers productsupport: questionCommunity support but can be turned into an improvementtype: new featureIntroduces a new piece of functionality or capability.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions