Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autocomplete] Allow tooltip text selection #36503

Merged

Conversation

safeamiiir
Copy link
Contributor

@safeamiiir safeamiiir commented Mar 13, 2023

@mui-bot
Copy link

mui-bot commented Mar 13, 2023

Netlify deploy preview

https://deploy-preview-36503--material-ui.netlify.app/

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against b939b8a

@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Mar 13, 2023
@zannager zannager requested a review from mnajdova March 13, 2023 10:02
@mnajdova mnajdova changed the title [Autocomplete] fix autocomplete preventing tooltip text selection [Autocomplete] Allow tooltip text selection Mar 13, 2023
@mnajdova mnajdova changed the title [Autocomplete] Allow tooltip text selection [autocomplete] Allow tooltip text selection Mar 13, 2023
@safeamiiir
Copy link
Contributor Author

safeamiiir commented Mar 13, 2023

I was trying to write an other test to check the user's onMouse text highlight/selection behavior but was not successful.

@@ -1007,13 +1007,25 @@ export default function useAutocomplete(props) {

// Prevent input blur when interacting with the combobox
const handleMouseDown = (event) => {
const isToolTipElement = event.target?.parentElement?.getAttribute('role')?.includes('tooltip');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this check is too specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see totally your point.
I'm working on it and looking at that other issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But regards to this issue only, I made a change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliviertassinari in case you missed it, I just made it general in a way that if user clicks anywhere outside the Autocomplete component, it prevents focusing. so then user is able to select text for instance.

@safeamiiir safeamiiir requested review from oliviertassinari and removed request for mnajdova March 22, 2023 17:01
@mnajdova mnajdova requested review from michaldudak and removed request for oliviertassinari April 12, 2023 08:18
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense to me 👌 cc @michaldudak

packages/mui-base/src/useAutocomplete/useAutocomplete.js Outdated Show resolved Hide resolved
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, seems OK to me.

@michaldudak michaldudak merged commit 5d8c58a into mui:master May 12, 2023
binh1298 pushed a commit to binh1298/material-ui that referenced this pull request May 17, 2023
Co-authored-by: Amirreza safehian <amirreza@RIV-D421TWWQ9V.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Autocomplete] Tooltip content selection is prevent in usage of tooltip
6 participants