QEditor loses caret after clearing model
See original GitHub issueDescribe the bug Clearing / refocusing to QEditor no longer works as it used to
Codepen/jsFiddle/Codesandbox (required) https://codepen.io/dsl101/pen/gOrdNJO
To Reproduce Steps to reproduce the behavior:
- Go to codepen
- Open console pane
- Enter some text into the QEditor, then hit CTRL+Enter
- The text is logged, cleared, but focus does not stay in QEditor
Expected behavior This code is lifted from a large application, and used to work, but in the last few weeks (months? not 100% certain when it stopped to be honest), the cursor is not positioned where it should be, and the QEditor is no longer ready for the next input. Sometimes the cursor is positioned right over to the far right of the component, sometimes it’s not visible at all.
Platform (please complete the following information): OS: Windows 10 Node: 12.16.2 NPM: 6.14.1 Yarn: 1.21.1 Browsers: Firefox, Safari, Chrome iOS: 13
Additional context
Note that the call to focus()
perhaps used to mask the (potential) real issue of clearing the model? At the moment, the behaviour is the same with or without the focus()
call.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top GitHub Comments
Can confirm this has fixed the QEditor issue I had. @emahuni if you’re using (for example) an appended button to clear the input model, that button will take the focus, and you must explicitly set the focus back—that’s not a bug.
@emahuni It’s not the same. QEditor deals with range selections, cut/copy/paste, etc. This is where the bug came into play…trying to restore the caret to a position that no longer existed. If you feel QInput on has a bug, please make a codepen and open a new issue. Thanks.