admin管理员组

文章数量:1356927

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

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

Share Improve this question asked Mar 21, 2017 at 7:49 JohnJohn 3372 gold badges6 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

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/m7tovuqa/

本文标签: javascriptHow to give a focus effect to my Draft JS Editor borderStack Overflow