Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give a focus effect to my Draft JS Editor border?

I understand that the draft js editor is not a classic textarea element. I applied some styles to make it look better. However, i can't find this little trick that doing a natural html focus effect when i'm focusing on my draftjs editor. I am not a css expert, i've tried to using the :active pseudo class the effect disappear once a release the click.

I just want the borders to be like a classic html input focus effect.

How can a set up this ?

thanks

like image 871
John Avatar asked Sep 18 '25 11:09

John


1 Answers

You can keep track of whether or not the editor has focus by listening for onFocus and onBlur on it. You can then use this information to set classnames accordingly. Here's an example that makes the border red when it has focus:

https://jsfiddle.net/m7tovuqa/

like image 68
tobiasandersen Avatar answered Sep 20 '25 01:09

tobiasandersen