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.

Add onFocus to Editor's contenteditable div

See original GitHub issue

It would be great to have a way of knowing when the contenteditable div in the editor is being focused; I would then set a state in the Editor: isFocused: true.

What do other people think about this? Can’t be that hard to implement.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JasonEtcocommented, Jul 20, 2016

Alright, sounds good. Thanks for listening @ianstormtaylor 👍

0reactions
ianstormtaylorcommented, Jul 20, 2016

It would definitely be more semantic for that use case, but then it might lead to having to have more and more custom handlers for specific pieces. I could be down to add it in a bit if it becomes a really common need. But for now I think it’s best to keep things simpler with just onChange or onSelectionChange if there’s a worry about document changes impacting it for performance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set focus on div contenteditable element - Stack Overflow
Bind a "click" event handler to all elements within the contenteditable div, and change the class/style on click (i.e. add class "focused" to...
Read more >
contenteditable focus state - CodePen
Adding Classes. In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template....
Read more >
contenteditable - HTML: HyperText Markup Language | MDN
Chrome Edge contenteditable Full support. ChromeYes. Toggle history Full suppo... contenteditable="caret". Experimental Full support. ChromeYes. Toggle history Full suppo... contenteditable="events". Experimental Full support. ChromeYes. Toggle history...
Read more >
Using HTML and contenteditable to build a rich text editor
There are several different methods to build rich text editors – one of them is using the contenteditable attribute, which allows you to...
Read more >
Focusing: focus/blur - The Modern JavaScript Tutorial
We can add tabindex from JavaScript by using the elem.tabIndex property. That has the same effect. Delegation: focusin/focusout. Events focus ...
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