Add onFocus to Editor's contenteditable div
See original GitHub issueIt 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:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top 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 >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
Alright, sounds good. Thanks for listening @ianstormtaylor 👍
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
oronSelectionChange
if there’s a worry about document changes impacting it for performance.