Skip to content

[autocomplete] Where is the debug mode in v5 #27837

Closed

Description

@ryank425
  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

I am using AutoComplete to list options that match with the query with custom renderOptions function, and have Tooltip on top of those options. I also have some interactions on Tooltip that allow me to drag components to others using React-dnd.

The only way to achieve this is by

  1. Add debug prop to --> <Autocomplete debug ...>
  2. Add

onMouseDown={(ev) =>{
                ev.stopPropagation();
            }}

to the top of JSX that goes into our tooltip title={...}

Only having two of them set, I can actually drag stuff from the tooltip.

Having onMouseDown to not stopPropagation would result in making all elements to be non draggable.
Having no debug prop on AutoComplete kills any interaction ability as even clicking anything inside tooltip just closes the whole tooltip, not even getting me to the point of dragging.

So, the concern is that I do not see any equivalent option for prop in AutoComplete in v5 version of the documentation. Is there any reason why such function disappeared all of sudden? I really want to try the next version due to some performance issues in v4, but I need this to still work as intended.

Examples 🌈

image

I don't know if this website is using Material UI components, but the screenshot contains exactly what I want to do in this case. Dragging elements from Tooltip to the outside from AutoComplete options.

Motivation 🔦

Activity

  1. added
    status: waiting for maintainer
    on Aug 18, 2021
  2. eps1lon commented on Aug 18, 2021

    @eps1lon
    Member

    So, the concern is that I do not see any equivalent option for prop in AutoComplete in v5 version of the documentation. Is there any reason why such function disappeared all of sudden?

    See #23377 for all the context

  3. added
    type: expected behavior
    and removed
    status: waiting for maintainer
    on Aug 18, 2021
  4. ryank425 commented on Aug 18, 2021

    @ryank425
    Author

    Having open={true} itself doesn't achieve what the debug mode achieved though.

    https://material-ui.com/api/autocomplete/

    debug bool false If true, the popup will ignore the blur event if the input is filled. You can inspect the popup markup with your browser tools. Consider this option when you need to customize the component.

    I am not trying to inspect the code with popups as I can trigger debugger to freeze the JavaScript Execution to do that. I just want the popup to ignore the blur event if the input is filled.

    Having open={true} means I will now have to go through all other additional event listeners like ESC, clicking outside of both Tooltip and Options list to manually change the state, to replicate what the code previously did with not passing open prop, only to have the following functionality: the popup will ignore the blur event if the input is filled.

    I agree that the naming of "debug" is bad, but I don't see why this was removed for the single reason of having a better debugging tools nowadays as there are legitimate cases that benefit from having this prop.

  5. added
    scope: autocomplete
    on Aug 21, 2021
  6. oliviertassinari commented on Sep 3, 2021

    @oliviertassinari
    Member

    I have just faced the same issue. I need to debug the Autocomplete for #27340 (comment) but I can't. Nor the open prop or

    Screenshot 2021-09-03 at 15 44 12

    reproduces the same outcome as the debug prop. What I really need to debug is to ignore the blur event.

  7. added and removed
    type: expected behavior
    on Sep 3, 2021
  8. ryank425 commented on Sep 3, 2021

    @ryank425
    Author

    @oliviertassinari Can we change the status of the issue, or should this be still remaining as closed?

  9. oliviertassinari commented on Sep 3, 2021

    @oliviertassinari
    Member

    @ryank425 Note that this prop was never meant to be enabled in production. We were probably missing a process.env.NODE_ENV = 'production'; to make it a no-op in prod.

  10. ryank425 commented on Sep 3, 2021

    @ryank425
    Author

    @oliviertassinari Ok, then will Material UI never support any prop that will do following? "the popup will ignore the blur event if the input is filled". Since this is an internal behavior of the library, I don't see how I can leave it open except for manually setting open to true and overriding all other escape behaviors to trigger open to false in the Autocomplete.

  11. oliviertassinari commented on Sep 3, 2021

    @oliviertassinari
    Member

    @ryank425 Then it's a completely different discussion, see event.defaultMuiPrevented mui/mui-x#1403. We have started to use it on the Autocomplete, with #23487. In your case, you can easily control the open state, and ignore the onClose event with the blur reason, so I think that we are good.

  12. changed the title [-][Autocomplete] Where is the debug mode in v5[/-] [+][autocomplete] Where is the debug mode in v5[/+] on Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionscope: autocomplete

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions