Improved keyboard functionality

From GitHub #558

Logseq text and blocks can’t be edited without using the mouse a lot, which is much slower. The below functions would help improve keyboard-only usage.

  • When a block is selected, arrow keys should unselect it and allow editing again without an additional mouse click.
  • Alt-Shift-Up only moves blocks when they are in editing mode. It should also work when blocks are selected. It should also be improved to work on several consecutive blocks.
  • Create keyboard shortcuts to allow the user to put the cursor in a specific block and begin editing, even when no block is currently selected and the page is not in editing mode. For implementation, see the Roam extensions Roam42 and/or Roam Navigator.
  • Create a keyboard shortcut to jump to the first or last block on a page
  • Create keyboard shortcuts to expand/collapse child items in several ways:
  • Expand/collapse everything below the current focused or selected block
  • Expand/collapse one level at a time for the whole page (e.g., unfold all level 1 and level 2 items, but keep levels 3+ folded)
  • Expand/collapse all levels at once for the whole page

sabre23t comment: " When a block is selected, arrow keys should unselect it and allow editing again without an additional mouse click.
This already works. Can use Arrow Up to edit previous block, and Arrow Down to edit next block, while you are editing current block."

my response: “By “selected”, I don’t mean that the cursor is in the block in edit mode. I mean selected in the sense that the whole block is highlighted when not in edit mode. To see this state, put the cursor in a block, hold Shift, and tap the up arrow key twice. There is no way to “un-highlight” that block now without using the mouse.”

@Cobblepot Thanks for putting all this together. I come from “Checkvist” where keyboard centric use is a core concept.

For you second point…

I even created a bug report …

and also for a similar problem here …

I fully agree that - for heavy use - a keyboard centric approach is essential. While typing, editing and searching your fingers are away from the mouse. Switching between mouse and keyboard again and again is slow and can be avoided.

1 Like

I would also like to add my voice to the great idea of adding a keyboard centric approach, which would mean to make sure that everything that can be done with the mouse, can also be done with the keyboard. You could see this as an accessibility goal.

Maybe a test suite (that doesn’t fail, so more as an indicator) that tries to keep track of all actions that can be done via keyboard would help? Then maybe the community can contribute to the test suite (if shortcuts are missing) or pick “failing” tests to implement new keyboard shortcuts.

2 Likes

Other things that I really miss,

Way to navigate to and from the sidebar, and move up and down items in the sidebar
Zoom in and out of a block (alt+right and alt+left) only work in edit mode. Confusing as I’m often navigating my blocks in command mode.

Overall more consistency, like use ctrl for all move action (fold/unfold, zoom in, zoom out) and alt for moving (up/down, indent, unident)

Would really be up for a discussion on how to make the keyboard experience better for new users. Even though that might just be stealing half of the keyboard commands from other tools I’m afraid.

Sources of inspiration could be:

  • macOS: in a folder list Finder window, CMD-right arrow and CMD-left arrow expand and collapse the currently selected folder (= block in Logseq) while ALT-ALT-right arrow and CMD-ALT-left arrow expand and collapse the selected folder AND all its subfolders (= sub-blocks in Logseq)
  • Dynalist outliner: the CMD-arrow up and CMD-arrow down move the currently selected block (and its sub-block) up or down keeping it at the same depth level in the block list

Upcoming keyboard shortcuts should work both in “block selection mode” and “block editing mode”, and should use CTRL instead of CMD in order to NOT interfere with the current macOS global text editing shortcuts: CMD-left-right arrows jump the cursor to the beginning/end of the current line/paragraph, ALT–left-right arrows jump the cursor to the next/previous word.