Fix issues with selected blocks#3006
Open
akulistus wants to merge 3 commits into
Open
Conversation
akulistus
requested review from
TatianaFomina,
gohabereg,
ilyamore88 and
neSpecc
as code owners
May 25, 2026 20:51
There was a problem hiding this comment.
Pull request overview
Addresses two regressions in multi-block selection editing: duplicated character insertion when multiple blocks are selected, and failure to replace selected blocks when typing Shift + printable key.
Changes:
- Adjust block-selection key handling to avoid programmatic caret insertion for normal printable keys (preventing duplicated characters).
- Treat
Shift + printable keyas normal text input (not a shortcut) so it replaces the selection. - Add Cypress coverage for replacing selected blocks via a single keystroke (including shifted printable input).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| test/cypress/tests/modules/Ui.cy.ts | Adds Cypress tests for replacing multi-block selections with printable and shifted-printable input. |
| src/components/modules/blockSelection.ts | Stops inserting typed printable characters via caret helper to avoid duplicate insertion when clearing a multi-block selection. |
| src/components/modules/blockEvents.ts | Refines shortcut detection so Shift + printable is handled as text input and selection is cleared/replaced. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+130
to
+134
| cy.get('[data-cy=editorjs]') | ||
| .find('.ce-paragraph') | ||
| .first() | ||
| .should('have.text', 'f'); | ||
| }); |
Comment on lines
+164
to
+167
| .click() | ||
| .type('{shift+downArrow}') | ||
| .type('{shift+F}'); | ||
|
|
Comment on lines
+168
to
+172
| cy.get('[data-cy=editorjs]') | ||
| .find('.ce-paragraph') | ||
| .first() | ||
| .should('have.text', 'F'); | ||
| }); |
Comment on lines
+97
to
+99
| describe('Replace', function() { | ||
| it('should replace selected blocks with a single keystroke', function() { | ||
| cy.createEditor({ |
| .should('have.text', 'f'); | ||
| }); | ||
|
|
||
| it('should replace selected blocks with a single shift + keystroke', function() { |
| * @type {boolean} | ||
| */ | ||
| const isShortcut = event.ctrlKey || event.metaKey || event.altKey || event.shiftKey; | ||
| const isShortcut = event.ctrlKey || event.metaKey || event.altKey || (event.shiftKey && !isPrintableKey); |
Comment on lines
+255
to
+257
| if (eventKey.length > 1) { | ||
| Caret.insertContentAtCaretPosition(''); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues with block selection
Shift + printable keydoesn't replace selected blocks.Solutions
Enteror an unrecognized key.Shift + printable keyas regular text input rather than a shortcut.