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

Cannot focus programmatically, because inputRef becomes null after typing something into the MentionInput #747

Open
torlenor opened this issue May 28, 2024 · 0 comments

Comments

@torlenor
Copy link

Steps to reproduce:

  1. Open the demo locally or via https://react-mentions.vercel.app/
  2. Go to Advanced options
  3. Click somewhere so that the MentionsInput is not focused
  4. Click on the button "focus programmatically"
  5. It works
  6. Now type something in the text field, click outside so that it is unfocused
  7. Click on the button "focus programmatically"
  8. It fails until you reload the page.

Expected behaviour:

Focus to work after you typed something in the text field

Observed behaviour:

Fails as soon as something was typed. The inputEl.current becomes null after you typed something.

react-mentions-focus_programmatically_fails_after_typing

Workaround:

Couldn't figure one out

@torlenor torlenor changed the title Focus programmatically, because inputRef becomes null after typing something into the MentionInput Focus programmatically doesn't work, because inputRef becomes null after typing something into the MentionInput May 28, 2024
@torlenor torlenor changed the title Focus programmatically doesn't work, because inputRef becomes null after typing something into the MentionInput Cannot focus programmatically, because inputRef becomes null after typing something into the MentionInput May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant