Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
RichText: selectionChange: bind on focus, unbind on blur #12480
This PR is an attempt to decrease the work done on a key press. Every key press is eventually followed by (several) selection change events. Every
The solution is to only add the listener on focus, then remove again on blur.
Testing on with this post I notice one selection change event takes on average 9ms to complete. With this PR it takes on average 0.3ms.
How has this been tested?
Types of changes
Nov 30, 2018
1 check passed
@iseulde, out of curiosity, do you have an idea if there would be a way to detect that you are still editing a given
In other words, whatever you do related to editing, we would need to be able to identify a currently active
This is where we want it to be. It's not yet there :( The issue is mostly when there are other components like
referenced this pull request
Dec 4, 2018
There's an issue with the changes here, in that if the component unmounts while it's focused and before it's blurred, an error can be logged. This can be seen when merging two blocks, for example.
I'll plan to submit a fix soon, which would be to call to remove the event handler still in