mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[pickers] `disableOpenPicker` prop not working on MobileDatePicker

Open julianCast opened this issue 2 years ago • 2 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Steps to reproduce 🕹

Link to live example on v5: https://codesandbox.io/s/heuristic-solomon-mxsrc0?file=/demo.tsx Link to live example on v6: https://codesandbox.io/s/distracted-tom-6m02r8?file=/demo.tsx

I used the example of your documentation, adding the disableOpenPicker to the three different date pickers. Only MobileDatePicker will still be able to be opened.

Current behavior 😯

MobileDatePicker ignores the disableOpenPicker and it's opened with interaction.

Expected behavior 🤔

MobileDatePicker should not open the picker after disableOpenPicker is used.

Context 🔦

No response

Your environment 🌎

This is my environment but, as I said, it's happening in your documentation example.

npx @mui/envinfo
 System:
    OS: macOS 13.0.1
  Binaries:
    Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
    Yarn: 3.3.0 - ~/.nvm/versions/node/v16.17.1/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
  Browsers:
    Chrome: 110.0.5481.100
    Edge: 110.0.1587.41
    Firefox: 108.0.1
    Safari: 16.1
  npmPackages:
    @emotion/react: ^11.10.5 => 11.10.5
    @emotion/styled: ^11.10.5 => 11.10.5
    @mui/base:  5.0.0-alpha.117
    @mui/core-downloads-tracker:  5.11.8
    @mui/lab: ^5.0.0-alpha.119 => 5.0.0-alpha.119
    @mui/material: ^5.11.8 => 5.11.8
    @mui/private-theming:  5.11.7
    @mui/styled-engine:  5.11.8
    @mui/system:  5.11.8
    @mui/types:  7.2.3
    @mui/utils:  5.11.7
    @mui/x-date-pickers: ^5.0.15 => 5.0.15
    @types/react: ^17.0.39 => 17.0.39
    react: 17.0.2 => 17.0.2
    react-dom: 17.0.2 => 17.0.2
    typescript: ^4.9.4 => 4.9.4

Order ID 💳 (optional)

No response

julianCast avatar Feb 24 '23 14:02 julianCast

API documents this prop and mentions that it controls the rendering of the open picker button. Is there a use case you @julianCast are trying to achieve and this behavior is stopping you from doing it? IMO we should be making some sort of a change in this regard. Either:

  • change the description and also not open view on mobile when it is toggled on;
  • remove this prop from available options on Mobile picker versions;

What's your take @flaviendelangle?

LukasTy avatar Feb 24 '23 15:02 LukasTy

Oh I misunderstood the meaning of it. I was trying to disable the opening. I think the first option would make sense :

change the description and also not open view on mobile when it is toggled on;

Thank you for the clarification!

julianCast avatar Feb 24 '23 15:02 julianCast

Oh I misunderstood the meaning of it. I was trying to disable the opening. I think the first option would make sense :

After discussing and investigating this issue further, it's clear that simply disabling the mobile picker opening would sort of make no sense, because that is the only behavior that is currently supported by the mobile picker versions.

This change should be done together with or after #7869.

LukasTy avatar May 02 '23 19:05 LukasTy