Comments (7)
Check this Link
Hi, @AndreyOstrovnev
I've use the propagation method to stop the parent (Autocomplete) from reacting when you click on the child ( that is the TextField ). Now nothing should happen, clicking underneath input. Thanks
from material-ui.
Thanks for the solution, @imran-yasin.
@AndreyOstrovnev, the issue occurs because the helper text is rendered within the Text Field component (using the FormHelperText component). Therefore, clicking on the helper text is treated as clicking on the Text Field itself. Following @imran-yasin's solution to stop the event propagation should resolve this issue. If that doesn't work, consider rendering the input component and FormHelperText component separately in the renderInput
callback of the Autocomplete.
from material-ui.
Hi @imran-yasin, thanks for the solution but your fix disables the event only on text. The content of helperText is wrapped in "p" tag which is still causes focus on input. So clicking right next to helper text will still trigger focus event. E.g. here:
from material-ui.
@AndreyOstrovnev Thank you for pointing that out! To prevent the focus event from being triggered when clicking next to the helper text, we need to apply the event handler to the entire helper text area, including the surrounding p
tag
Check this Updated Version
from material-ui.
@imran-yasin I got your idea of fixing it, thanks for helping! There are still some places when the background area is clickable because p
tag you added doesn't exactly match with outer tag added by MUI: <p class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root" id="combo-box-demo-helper-text"> ...
. I achieved the expected behavior by moving out helper text completely out of Autocomplete component at the same level as a sibling. But the thing is for me it looked like a workaround of existing behavior.
from material-ui.
Hi @ZeeshanTamboli, since the issue is closed, I'm assuming there is no unexpected behavior and no plan to fix it?
from material-ui.
@AndreyOstrovnev, upon further consideration, I agree with your assessment. Rendering the helper text separately from the input seems like the best approach. As demonstrated in the following demo: https://mui.com/material-ui/react-text-field/#helper-text, clicking on the helper text does not focus the input. This issue is duplicate of #26153. So I am marking it as a duplicate. Follow #26153 for more updates.
from material-ui.
Related Issues (20)
- Module not found: Error: Can't resolve '@mui/base/className' in '/app/node_modules/********/ui-toolkit/node_modules/@mui/material/utils' HOT 1
- [joy-ui][Button] The user can see the text by highlighting when loading is true
- @mui/material incompatible with versions of @types/react > 18.2.60
- [system][docs] Missing content regarding possible Box's styling approaches HOT 1
- [website] Inconsistent card display at 100% zoom level HOT 1
- [system] useColorScheme should return null during hydration
- [material-ui][Menu] Submenu closes improperly HOT 5
- [website] Site responsiveness and adaptability when zooming HOT 4
- [material-ui][Menu] Issues building a context menu HOT 4
- [material-ui] Standardize event handler callbacks
- [material-ui][Switch] Issues with styling before refreshing the page HOT 5
- Styleprovider doesn't seem to work on dynamically rendered components inside shadow dom HOT 5
- [material-ui][Switch] Unsupported color after upgrade @mui/material to 5.15.13 HOT 4
- CSP issue in React Project
- [material-ui][Typography] Migrating from v4 to v5 issue HOT 2
- [joy-ui] The latest betas aren't available on `latest` HOT 1
- [material-ui][docs] Continued reloading happening on Firefox HOT 1
- [material-ui] Not able to build the project when updating to Next.js 14.2.2 with v5.15.15 HOT 5
- [material-ui][TextField] TypeScript not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-ui.