[Tooltip] onFocus does not work on TextField if using a Tooltip with it
See original GitHub issue- 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 😯
onFocus
does not work if using a Tooltip
with TextField
:
<Tooltip title="Some hint">
<TextField onFocus={() => {console.log("This cannot work!")}} />
</Tooltip>
This problem does not exist in Material-UI version <=4.7.1
Expected Behavior 🤔
onFocus
can work when using a Tooltip
.
Steps to Reproduce 🕹
https://codesandbox.io/s/modest-proskuriakova-z9sob
Steps:
- Add a
TextField
to let user input something. - Bind an
onFocus
function to theTextField
. -> The function works well. - Add a
Tooltip
to theTextField
to show some hint for user. -> TheonFocus
function does not work any more.
Context 🔦
I found this issue after I upgrade Material-UI to latest version. Now I have to use native input
instead of TextField
to avoid this problem.
Please correct me if I’m using the component wrongly. Thanks in advance!
Checked the source code, I think the problem is caused by this commit: https://github.com/mui-org/material-ui/commit/c98b9c47c5df2c94a72d5ce2b5169c1c53a1d842
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.4 |
React | v16.13.0 |
Browser | Chrome 80 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
[Tooltip] onFocus does not work on TextField if using ... - GitHub
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >angularjs - Popping a tooltip on focus when you can't add the ...
I have a field directive with an isolate scope that covers the input and the label associated with it, so that is the...
Read more >Showing jQuery UI tooltip on focus of text box
To that end, I created the following code that shows and hides the tooltip when the user clicks into/out of the textbox: $(function...
Read more >Tooltip | Components - BootstrapVue
Easily add tooltips to elements or components via the component or v-b-tooltip directive.
Read more >ARIA Tooltip Example - Accessibility at Athena ICT
The tooltip never receives focus. Focus stays on the textbox. The tooltip widget can shown via keyboard focus or by the onmouse event....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@netochaves “good first issues” are meant to ramp up new contributors, given you have already done a none negligible number of contributions, I think that it would be better to focus on harder issues. Thanks
@sudoStatus200 I think we should look at
disableFocusListener
after the proposed changes. Might be thatdisableFocusListener
just affects the symptoms but doesn’t have to do anything with the cause of the issue.