Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Mac keyboard shortcuts work unexpectedly across blocks #9880

Open
ranh opened this issue Sep 13, 2018 · 6 comments
Open

Some Mac keyboard shortcuts work unexpectedly across blocks #9880

ranh opened this issue Sep 13, 2018 · 6 comments
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Enhancement A suggestion for improvement.

Comments

@ranh
Copy link

ranh commented Sep 13, 2018

Mac OS has a subset of keyboard shortcuts for manipulating text that use the Control key and are borrowed from Emacs. For example, Control+N to move the cursor down one line; Control+D to delete the character to the right of the cursor; etc. Complete list of Mac OS keyboard shortcuts.

These shortcuts work fine inside of blocks, but not between blocks. They seem to behave as though a single block is the whole document.

To Reproduce

Steps to reproduce the behavior with Control+P (up) and Control+N (down):

  1. Position the cursor in the middle of the text inside a block that is in the middle of a document.
  2. Press Control+P to move the cursor up to the first line of the block.
  3. On the first line, pressing Control+P will move the cursor to the beginning of the line, and won't move it any further.
  4. Pressing Up Arrow will move the cursor to the previous block, as expected.
  5. Repeat for Control+N: press to move the cursor to the last line of the block.
  6. On the last line, pressing Control+N will move the cursor to the end of the line, and won't move it any further.
  7. Pressing Down Arrow will move the cursor to the next block, as expected.

Expected behavior

  • Control+P should work the same as Up Arrow in the beginning of a block: move to the previous block.
  • Control+N should work the same as Down Arrow in the end of a block.
  • Control+F should work the same as Right Arrow (or Left Arrow in an RTL document) in the end of a block: move to the next block.
  • Control+B should work the same as Left Arrow in the beginning of a block.
  • Control+H should work the same as the Delete key in the beginning of a block: merge it with the previous block.
  • Control+D should work the same as Function+Delete in the end of a block
  • Control+K should work as it does before Gutenberg: delete from the cursor position to the end of the paragraph, and keep deleting the following paragraphs (so it's like it's eating your document from the inside.) It only deletes to the end of the current block.

There is also Control+O, to insert a new line after the cursor without moving the cursor, effectively the same as Return and then Left Arrow. In Gutenberg it adds a line break, so it's actually Shift+Return and then Left Arrow. The expected behaviour might be to split the block (same as Return would).

Desktop (please complete the following information):

  • OS: Mac OS 10.13.6
  • Browser: Chrome 69 and Safari 11.1.2
@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Sep 13, 2018
@ranh
Copy link
Author

ranh commented Sep 17, 2018

Note that the same issue can be seen when moving between table cells. Movement with the Control+ shortcuts is confined to a single cell in the same way it is confined to a single block.

For example, it's possible to use Down Arrow to move down across table cells, but using Control+N will not move past the end of the first cell.

@adamwoodnz adamwoodnz added the Needs Testing Needs further testing to be confirmed. label Jun 1, 2022
@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 25, 2022
@apeatling
Copy link
Contributor

Still valid.

@ndiego ndiego removed Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Aug 30, 2022
@Mamaduka Mamaduka added the [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... label Aug 30, 2022
@mtias
Copy link
Member

mtias commented Jul 2, 2024

@jeryj can this be incorporated into #51356 ?

@jeryj
Copy link
Contributor

jeryj commented Jul 2, 2024

Yes, I think incorporating these mac shortcuts into #51356 would be helpful. I'll be AFK the rest of this week, but can get to it when I get back if no one else does first.

@jeryj
Copy link
Contributor

jeryj commented Jul 10, 2024

I added Ctrl + P and Ctrl + N to the shortcuts tracking. How far deep do we want to go with the mac shortcuts? I'll start chipping away at testing them unless I hear otherwise. Here's a list of them that have to do with movement of the caret:

⌥ Delete: Delete the word to the left of the insertion point.
⌃ H: Delete the character to the left of the insertion point. Or use Delete.
⌃ D: Delete the character to the right of the insertion point. Or use Fn-Delete.
⌃ K: Delete the text between the insertion point and the end of the line or paragraph.
⌥←: Move the insertion point to the beginning of the previous word.
⌥→: Move the insertion point to the end of the next word.
⇧⌘↑: Select the text between the insertion point and the beginning of the document.
⇧⌘↓: Select the text between the insertion point and the end of the document.
⇧⌘←: Select the text between the insertion point and the beginning of the current line.
⇧⌘→: Select the text between the insertion point and the end of the current line.
⇧↑: Extend text selection to the nearest character at the same horizontal location on the line above.
⇧↓: Extend text selection to the nearest character at the same horizontal location on the line below.
⇧←: Extend text selection one character to the left.
⇧→: Extend text selection one character to the right.
⌥⇧↑: Extend text selection to the beginning of the current paragraph, then to the beginning of the following paragraph if pressed again.
⌥⇧↓: Extend text selection to the end of the current paragraph, then to the end of the following paragraph if pressed again.
⌥⇧←: Extend text selection to the beginning of the current word, then to the beginning of the following word if pressed again.
⌥⇧→: Extend text selection to the end of the current word, then to the end of the following word if pressed again.
⌃ A: Move to the beginning of the line or paragraph.
⌃ E: Move to the end of a line or paragraph.
⌃ F: Move one character forward.
⌃ B: Move one character backward.
⌃ L: Center the cursor or selection in the visible area.
⌃ P: Move up one line.
⌃ N: Move down one line.
⌃ O: Insert a new line after the insertion point.
⌃ T: Swap the character behind the insertion point with the character in front of the insertion point.

A lot of them work already. The main issue, as @ranh already mentioned, is that each block behaves as a full document instead of each block being considered part of the same document.

Btw, I enjoyed this description of Control + K 😅

it's like it's eating your document from the inside

@ellatrix
Copy link
Member

Related: #8353, #5805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

9 participants