question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forcing focus breaks plugins

See original GitHub issue

I’ve noticed that when i call focus() on the Editor, the emoji and mention plugins do not work – that is, they do not respond to : or @ and suggestions do not populate. I’m guessing focus() is somehow messing with the selectionState…any ideas on this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:20
  • Comments:21

github_iconTop GitHub Comments

21reactions
ryanmcclure4commented, Jul 18, 2017

I was able to find a temporary solution to this problem by using setTimeout on the call to focus:

setTimeout(this.editor.focus, 50)

Strangely enough, this seems to solve the problem even if you set the timeout value to 0.

My original guess on why this works was that there is still something in the mention suggestions that is still in the process of mounting or rendering, but the parent component’s componentDidMount should’t be called until after all this is complete…so really not sure.

15reactions
diegohazcommented, Oct 16, 2017

I just spent about 2 hours to figure out why my mention and linkify plugin weren’t working. That was so frustrating.

We should give more attention to this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve your focus by taking more breaks every day
Taking breaks during the day can help you focus and get more done, not to mention it's good for your brain. Use these...
Read more >
Multi-step form CSS broken by focus() - WordPress.org
It appears to be because the autofocus (cursor) that loads in the “First Name” textbox is being taken as the relative position of...
Read more >
The 8 best apps to help you focus and block distractions in 2023
With that, here's the focusing software I think works best. Best focus app for blocking distractions on all your devices at once. Freedom...
Read more >
3 Ways to Force Yourself to Focus | The Muse
1. Strict Workflow. This Chrome plugin is a simple way to try out the Pomodoro technique—a proven method that has you take five-minute...
Read more >
Managing Focus | Draft.js
With that in mind, at Facebook we often choose to expose focus() methods on components that wrap text inputs. This breaks the declarative ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found