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

Try adding focus outline for blocks that don't have input fields #3951

Merged
merged 5 commits into from
Dec 13, 2017

Conversation

jasmussen
Copy link
Contributor

This probably fixes #3560 and maybe fixes #1829.

When you select a block, we show outlines for that block. When you then start writing, those outlines and all the controls fade out, letting you focus on the text. But when you then use arrowkey navigation to move between blocks and encounter a block that has no textfield, there's no indication what's selected. This is nicely illustrated in #3560.

This PR tries to address that, by showing an indicator on blocks that have no input fields. And so in absence of a caret cursor to indicate your place, there's now an outline:

block-indicator

In addition to highlighting your place in the block list, this is also useful in indicating that you can press Enter to make a linebreak, or press Delete or Backspace to delete the indicated block.

Joen Asmussen added 4 commits December 8, 2017 12:23
This PR is an experiment to add a focus style for blocks have focus when using just the keyboard. It is experimental right now, but it could potentially provide a nicer editing flow, by showing what's selected when your caret disappears and a block is instead selected. Obviously when that happens you can press delete or backspace to remove said block, or you can press enter to make a linebreak.
@jasmussen jasmussen added the [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... label Dec 12, 2017
@jasmussen jasmussen self-assigned this Dec 12, 2017
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like this change, might be good to have a second opinion.

@@ -39,6 +39,14 @@
}
}

// This is a focus style shown for blocks that need an indicator even when in an isEditing state
// like for example an image block that receives arrowkey focus.
.editor-visual-editor .editor-block-list__block:not( .is-selected ) .editor-block-list__block-edit:focus {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be moved to the editor/components/block-list/style.scss file? Thinking this style could be usefulll regardless of the layout.

@jasmussen
Copy link
Contributor Author

I pushed a tiny tweak to the indicator style:
caret position

@jasmussen
Copy link
Contributor Author

🎉

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...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider unfading outlines when moving arrowkeys between blocks Image block keyboard focus and tab order
3 participants