Skip to content

[Autocomplete] Simplify tooltip usage in options #19254

@sherodtaylor

Description

@sherodtaylor

I found an issue with the implementation of autocomplete. If you look at the PR you generate the props from the useAutocomplete hook and pass that directly to the li. This is an issue because #11601 you are passing disabled directly from that which doesn't allow for the Tooltip workaround on the disabled elements here

I've already implemented this in #19235. I feel like this is a valid solution since you are currently able to change the 'ListBoxComponent = ul` to anything. You should have more control over the list item.

Also if you change the ListboxComponent to a div look at the HTML rendering. It renders invalid HTML and you can't change the li to anything you need:

Screen Shot 2020-01-15 at 10 35 00 AM

Heres a demo for the above screenshot:

Edit Material demo

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The Tooltip isn't opening for disabled items.

Expected Behavior 🤔

I expect Tooltip to render for disabled items. Using the workaround here the disabled items should render.

Steps to Reproduce 🕹

We need to be able to use the Tooltip to explain to our users why an item is disabled. See example below:

Edit Material demo

Steps:

  1. Setup Autocomplete like above ^
  2. Try to render a tooltip
  3. The disabled items will not open the tooltip however the ones, not disabled will.

Context 🔦

We need to be able to use the Tooltip to explain to our users why an item is disabled.

Your Environment 🌎

Check the above code sandbox for more info.

Tech Version
Material-UI v4.8.3
Material-UI-Lab v4.0.0-alpha.39
React 16.12.0
Browser Chrom
TypeScript 3.7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeIntroduces changes that are not backward compatible.good first issueGreat for first contributions. Enable to learn the contribution process.scope: autocompleteChanges related to the autocomplete. This includes ComboBox.type: new featureExpand the scope of the product to solve a new problem.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions