Repository navigation
fix(readonly): restore autofocus when switching to editable mode - #3059
Anurag-S1ngh wants to merge 6 commits into
Conversation
When the editor starts in read-only mode with autofocus enabled, switching back to editable mode re-renders the blocks but never sets the caret, so keyboard input does not reach the editor. Set the caret to the first block after rendering. Fixes codex-team#2316
neSpecc
left a comment
There was a problem hiding this comment.
Please add a Fix line to docs/CHANGELOG.md under 2.32.0.
|
Added to |
…after-readonly # Conflicts: # docs/CHANGELOG.md
|
The main issue is still not fixed: #3059 (comment) and this #3059 (comment) |
|
Autofocus is now one-shot: when the editor starts read-only it is recorded and applied on the first switch to editable, then cleared. Added tests for autofocus disabled, switching back to read-only, and an editor that started editable. All Cypress specs pass. |
|
Cypress fails at |
|
@Anurag-S1ngh I've fixes Cypress, please update a branch |
…autofocus-after-readonly
|
Merged |
Summary
When the editor is initialized with
readOnly: trueandautofocus: true, switching back to editable mode re-renders the blocks but never places the caret, so keyboard input does not reach the editor.Changes
autofocusis enabled.Testing
nextwith a custom block tool: before the changedocument.activeElementstayedBODYafter enabling editing. After the change the first block's contenteditable is focused and the selection is inside the editor.eslintpasses with 0 errors. The Cypress suite was not run locally because the Cypress binary was not installed.Closes #2316