Skip to content

[Tooltip] onFocus does not work on TextField if using a Tooltip with it #19883

@kidokidozh

Description

@kidokidozh
  • 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:

  1. Add a TextField to let user input something.
  2. Bind an onFocus function to the TextField.
    -> The function works well.
  3. Add a Tooltip to the TextField to show some hint for user.
    -> The onFocus 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: c98b9c4

Your Environment 🌎

Tech Version
Material-UI v4.9.4
React v16.13.0
Browser Chrome 80

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGreat for first contributions. Enable to learn the contribution process.scope: tooltipChanges related to the tooltip.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions