Closed henrik-wolf closed 2 years ago
I think it would be better to await
a new Promise
that resolves when the element's transitionend
event fires.
I agree that this is much cleaner. Although I do not think it is necessary to await anything. In the new commit I put everything into the transitionend event. Now, after the transition turns the box visible we focus on the text field. If you still think this should be handled in an asynchronous function, could you give me some pointers as to what would be the preferred pattern for doing something like this?
@SuperGrobi I think I found a better way to fix the focus bug: https://github.com/ether/etherpad-lite/pull/5485
It still requires a change in ep_comments_page, so I rebased your branch and pushed some changes. If everything looks OK to you I'll squash my changes with yours and merge.
Though we should probably add a test first...
I added a test.
When you add a new comment, the text field which pops up should automatically get the focus. This behaviour was expressed in the code but unfortunately not working. I believe this is due to
focus()
being called before the form is visible. By adding an interval that repeatedly tries to change the focus (until it works) with small times in between I was able to fix this problem.