Gutenberg: Expand selection on consecutive ⌘A commands

Created on 9 Jan 2018  Â·  19Comments  Â·  Source: WordPress/gutenberg

This ticket suggests a potential enhancement to the Select All shortcut (⌘A).

(⌘ refers to the Mac command, on Windows and Linux the modifier key would be Ctrl)

Current behavior

The current behavior is the following

  1. When the caret is inside a paragraph, ⌘A selects all text in the paragraph block. Similarly, for more complex blocks with lots of input fields and textareas, ⌘A simply selects all text inside the focused field.
  2. When you have no blocks selected, ⌘A invokes a multi-select of all blocks on the page

Proposal

Proposal: you can press ⌘A consecutively, to expand the selection. From 1 to 2. Escape deselects.

Example 1:

  • You have 5 paragraphs in a post, the caret is in the first paragraph block.
  • ⌘A once selects all text in the first paragraph block
  • ⌘A twice invokes a _multi-select_ of the first paragraph block, i.e. it's now selected at the block level
  • ⌘A thrice selects all blocks on the page.

Example 2:

  • You've 5 various blocks on a post, the caret is in the caption of an image block
  • ⌘A once selects all text in the caption
  • ⌘A twice selects the image block at the block level, including the caption
  • ⌘A thrice selects all blocks on the page

Example 3:

  • You've a single block on the post, a complex contact form. A checkbox or some other obscure widget has focus.
  • ⌘A once selects this entire contact form block at the block level.
  • ⌘A twice, well, it would select all blocks on the page, but since you already did that a bullet ago, you're already there.

Why?

Making it easier to select a single block at the block level is useful for deleting just that block quickly.

Making it easier to select all blocks on the page, without first deselecting all blocks, makes it more easy to copy/paste posts.

See also #4284 (and specifically the comment by @iseulde in https://github.com/WordPress/gutenberg/issues/4284#issuecomment-355368478 that inspired this).

See also #2303.

[Feature] Writing Flow [Type] Enhancement

Most helpful comment

Good to know, thanks @jasmussen! I do now realize the double ⌘A option exists, but I didn't realize it existed until I read this thread. This poses a learning curve question.

It'd be interesting to have more contextual "tips" here, so the first time you press ⌘A a tip can appear saying that if you continue pressing selection would expand. Similar to what Slack does if you press tab too many times.

All 19 comments

What should the single block selection look like? The same as now? Leaving it look the same might be a bit confusing in this context though.

It sounds related to #3232 where a variant of single block selection is needed. If we need these to look different, it might be good to list the circumstances in which it is allowed to look different. And if it looks different, should it also act different in any way?

What should the single block selection look like? The same as now? Leaving it look the same might be a bit confusing in this context though.

Yes, there are incidentally some mockups here: https://github.com/WordPress/gutenberg/issues/4382

It sounds related to #3232 where a variant of single block selection is needed. If we need these to look different, it might be good to list the circumstances in which it is allowed to look different. And if it looks different, should it also act different in any way?

In https://github.com/WordPress/gutenberg/issues/4382 I suggested an approach that simplifies things a bit, and slightly changes how _block selection_ works. The hope is to reduce complexity, but there may be loose ends.

I was frustrated today in using Gutenberg 2.2 regarding the current behavior of ⌘A being limited to the block my cursor was in. I think fixing this issue would be a big step forward.

Currently, only a Gutenberg developer would know that one has to first entirely remove the cursor from a block, and then press ⌘A, just so one can Select All content. This current behavior creates a harder to learn writing atmosphere.

Right now the following behavior occurs in master with a Paragraph block:

  1. The first Ctrl+A selects all the text in the block.
  2. The second Ctrl+A appears to do nothing.
  3. The third Ctrl+A selects all blocks.

Hi there! I'd like to make the case for ⌘A to function more like we historically expect to work in editing environments like Word, Google Docs and the classic editor. Let's make it so the first ⌘A selects everything on the page, not just what's inside an individual block.

Rationale:

  • As a writer, it's what I expect across all editing apps, including Word, Google Docs and the classic editor. This means it's one less thing we need to teach to new users.
  • ⌘A with multi-block formatting would significantly reduce the friction for formatting text quickly across blocks.
  • Selecting all of the text inside of just one paragraph is a feature not previously available inside legacy editing applications -- so it's not clear that a writer or editor needs this level of granularity when they can already drag or use a cursor to highlight text. (I have some additional questions about HOW one highlights text in Gutenberg, but I'll save that for another issue.)
  • As a writer I would not have realized that using ⌘A multiple times would change what it's highlighting. To educate users would require more instruction.

Adding a second and third ⌘A option might still make sense, but at least on the first ⌘A I believe we should aim to replicate the expected behavior already established.

@markarms Thanks for your thoughts.

If/when we find a way in the future to let you select across paragraphs not at the block level, I agree it makes sense to change the ⌘A behavior to directly select all the blocks. However as it is today, every paragraph is an input field and the basic behavior of an input field is that ⌘A selects all content inside it.

In other words, ⌘A to select all text in the entire editing canvas I feel is tied to selecting across paragraphs at an inline level. I don't feel we should do one without the other.

⌘A twice (⌘A to select all text, ⌘A again when all text is already selected to select all blocks) _should_ already work in the plugin. There see to e some platform specific bugs we have to iron out, but overall this is implemented.

Good to know, thanks @jasmussen! I do now realize the double ⌘A option exists, but I didn't realize it existed until I read this thread. This poses a learning curve question.

Also completely understand the logic of treating a text block as an independent input field. Still, there's a tension between that and the logic of what a writer and editor expects based on previous experiences in Word / Google Docs.

Absolutely understand it. I would love to see the cross-paragraph selection happen at some point, but for now we've considered it a tradeoff we were willing to make for the shipping version, considering the other benefits this had. I'm hoping the vastly improved copy/paste will allow you to write in an authoring app of your choice, whether Word, Google Docs or a Markdown editor, can mitigate these tradeoffs in the meantime.

Good to know, thanks @jasmussen! I do now realize the double ⌘A option exists, but I didn't realize it existed until I read this thread. This poses a learning curve question.

It'd be interesting to have more contextual "tips" here, so the first time you press ⌘A a tip can appear saying that if you continue pressing selection would expand. Similar to what Slack does if you press tab too many times.

Yes, I believe @karmatosed is a fan of that idea as well. Now that we have the keyboard shortcuts popover done, perhaps this is easyish to do? @talldan any thoughts?

What did you have in mind @jasmussen?

I imagine we'd want it to be quite a small contextual tip, not dissimilar to a tooltip on an icon button? I think it's quite important with those kind of tips that they don't get in the way of the user's process at all.

What did you have in mind @jasmussen?

I imagine we'd want it to be quite a small contextual tip, not dissimilar to a tooltip on an icon button? I think it's quite important with those kind of tips that they don't get in the way of the user's process at all.

Basically what Slack does. I wanted to record a GIF for you, but it seems this tip shows only once, and it's already shown for me. So basically try this — go to Slack, press tab a bunch of times. After you press Tab two or three times, if I recall correctly, a modal alert like prompt shows up asking you if you like keyboard shortcuts, and suggesting a bunch of others you could try.

In this case, perhaps the first or second time you press ⌘A we'd show a similar alert-like prompt that would explain some of the ⌘A consecutive features, as well as direct you to the keyboard shortcuts modal in the ellipsis menu maybe.

Here's the slack help:
screen shot 2018-08-20 at 11 43 07 am

I see what you mean :) I had in mind a smaller tooltip, but this is a full modal.

I think there are similarities to our existing NUX tips, since it's contextual.

Yep, for tips, definitely ask @karmatosed for help.

In this case, given the ultra-contextual nature of this tip, and the fact that it only happens once, I personally think it's totally fine to throw up a huge blocking modal. Anecdotal evidence: it's never bothered anyone in Slack, and quite the opposite it's inspired us ;)

Can someone clarify which action items remain here?

It should only be the one from https://github.com/WordPress/gutenberg/issues/4369#issuecomment-413554174:

It'd be interesting to have more contextual "tips" here, so the first time you press ⌘A a tip can appear saying that if you continue pressing selection would expand. Similar to what Slack does if you press tab too many times.

So the first time one presses ⌘A, a tip pops up suggesting multiple ⌘A's can select all. Perhaps that's best as a new ticket: "contextual tips".

Action item:

Change the select all shortcut so that it gradually selects more content.

⌘A twice selects the image block at the block level, including the caption

Given that the initial task was accomplished and seems to be working, perhaps we should indeed close this.

Alternately, because the remaining action item is related to tips, we could rename this ticket or close it and create a new one for "Show tip when pressing ⌘A the first time"?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

youknowriad picture youknowriad  Â·  3Comments

ellatrix picture ellatrix  Â·  3Comments

moorscode picture moorscode  Â·  3Comments

hedgefield picture hedgefield  Â·  3Comments

nylen picture nylen  Â·  3Comments