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

Add more writing flow options: Reduced UI, theme styles, spotlight #22494

Merged
merged 11 commits into from Oct 2, 2020

Conversation

youknowriad
Copy link
Contributor

@youknowriad youknowriad commented May 20, 2020

The spotlight mode hasn't received love for some time now. This PR is an experiment to be a bit more opinionated on this mode which could make it more useful too :)

Here's how it looks

Capture d’écran 2020-05-20 à 1 05 35 PM

@youknowriad youknowriad added [Type] Enhancement A suggestion for improvement. General Interface Parts of the UI which don't fall neatly under other labels. Needs Design Feedback Needs general design feedback. labels May 20, 2020
@youknowriad youknowriad self-assigned this May 20, 2020
@github-actions
Copy link

github-actions bot commented May 20, 2020

Size Change: -187 B (0%)

Total Size: 1.18 MB

Filename Size Change
build/block-directory/index.js 8.55 kB -57 B (0%)
build/block-editor/index.js 129 kB -43 B (0%)
build/block-editor/style-rtl.css 10.9 kB -16 B (0%)
build/block-editor/style.css 10.9 kB -16 B (0%)
build/block-library/index.js 135 kB -98 B (0%)
build/block-serialization-default-parser/index.js 1.78 kB +1 B
build/components/index.js 169 kB -8 B (0%)
build/components/style.css 15.4 kB -1 B
build/compose/index.js 9.42 kB +2 B (0%)
build/data-controls/index.js 685 B -585 B (85%) 🏆
build/data/index.js 8.6 kB +189 B (2%)
build/edit-navigation/index.js 10.7 kB -2 B (0%)
build/edit-post/index.js 306 kB +249 B (0%)
build/edit-post/style-rtl.css 6.29 kB +37 B (0%)
build/edit-post/style.css 6.27 kB +38 B (0%)
build/edit-site/style-rtl.css 3.83 kB +50 B (1%)
build/edit-site/style.css 3.83 kB +51 B (1%)
build/edit-widgets/index.js 21.1 kB +12 B (0%)
build/editor/index.js 45.5 kB +11 B (0%)
build/element/index.js 4.44 kB +1 B
build/escape-html/index.js 734 B +1 B
build/format-library/index.js 7.49 kB -3 B (0%)
build/is-shallow-equal/index.js 710 B +1 B
build/media-utils/index.js 5.12 kB -1 B
build/plugins/index.js 2.44 kB -1 B
build/priority-queue/index.js 790 B +1 B
build/server-side-render/index.js 2.6 kB -2 B (0%)
build/shortcode/index.js 1.7 kB +1 B
build/url/index.js 4.06 kB +2 B (0%)
build/warning/index.js 1.13 kB -1 B
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.52 kB 0 B
build/api-fetch/index.js 3.35 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-library/editor-rtl.css 8.6 kB 0 B
build/block-library/editor.css 8.6 kB 0 B
build/block-library/style-rtl.css 7.65 kB 0 B
build/block-library/style.css 7.65 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 47.5 kB 0 B
build/components/style-rtl.css 15.4 kB 0 B
build/core-data/index.js 12 kB 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-site/index.js 20.4 kB 0 B
build/edit-widgets/style-rtl.css 3 kB 0 B
build/edit-widgets/style.css 3 kB 0 B
build/editor/editor-styles-rtl.css 492 B 0 B
build/editor/editor-styles.css 493 B 0 B
build/editor/style-rtl.css 3.83 kB 0 B
build/editor/style.css 3.82 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.54 kB 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/index.js 3.02 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/notices/index.js 1.69 kB 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/primitives/index.js 1.34 kB 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 13 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/viewport/index.js 1.74 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@youknowriad
Copy link
Contributor Author

@jasmussen @mapk Any thoughts on this?

@jasmussen
Copy link
Contributor

jasmussen commented May 25, 2020

From the ping I expected to see spotlight mode expanded to template part editing :)

I've mixed feelings on this one. I share your desire for a leaner experience — a "writing mode", so to speak. Iceberg is a good example of how that can work in a plugin sense, it takes over entirely and removes any editor styles the theme might have and inserts its own.

This PR hides the tool indication, undo/redo, document outline, block navigation, and preview. As you know, I'd love to merge the document outline with the block navigation tool, that's one button down. Undo/redo are helpful to surface, both to remind people they exist, and they are the only way to undo on mobile. The tool indicator is a good way to indicate that you're in navigation mode, and per some explorations Shaun is exploring, that tool might even contain more effects on the block building side of things. In that vein, I don't think you could enable focus mode and "forget about it" — you'd have to jump in and out of it depending on what you're doing.

That suggests a different question: is there a place for a dedicated "writing mode" in the block editor, and is the focus mode what should be leveraged for that?

If we did decide that yes, there's a place for a writing mode, we could consider going way further — like full-screen, no editor style, supply an opinionated font and layout. Something more like "Reading mode" in Safari, but for writing. I could see myself jumping in and out of this with a toggle. But I'm very on the fence about whether this is something for the core product, or plugin territory.

@youknowriad
Copy link
Contributor Author

If we did decide that yes, there's a place for a writing mode, we could consider going way further — like full-screen, no editor style, supply an opinionated font and layout

I've been discussing with @mtias a bit here too and I think the original idea behind the "spotlight mode" was to be that "writing mode" you're talking about which means in these situations, you may not need block navigation, edit/select tool, undo redo... as there are keyboard shortcuts for all of these.

Iceberg is actually an inspiration for this PR too and I do believe proposing to get rid of editor styles is a good option to have too.

Before opening the PR, I was wondering whether we'd need granular options (hide undo, hide navigation, disable editor styles) and the realization is that we probably need both. An opinionated mode (like Spotlight) that enables everything needed for a writing mode and more granular options on the modal to fine-tune.

@jasmussen
Copy link
Contributor

as there are keyboard shortcuts for all of these.

That reminds me of #13688 by @enriquesanchez, wherein you hold down the modifier key for a short while to visually surface the keyboard shortcuts. In an opinionated writing mode (we should call it that, if it's what it becomes) like this, you could surface both the button and the keyboard shortcut when holding the modifier key.

If we were to move forward with this, I'd think that unloading editor styles in this mode, and providing a nice alternative, would be crucial to figure out whether it works. Additionally, I'd personally be fine with postponing any option toggles.

@enriquesanchez
Copy link
Contributor

A writing mode sounds really interesting and useful. This could maybe even be a tool next to 'Select' and 'Edit'.

I'm also having mixed feelings, but probably for different reasons. I think this is because if such mode were to exist, I'd prefer if blocks and their related UI just went away. I'd love it if there were no block toolbars, no inserter buttons, etc. Just me and my text.

@mapk
Copy link
Contributor

mapk commented May 27, 2020

Good step toward a better spotlight mode. ❤️ I like the elimination of several tools that can be restricted to keyboard shortcuts. But if we go toward a WRITING MODE, I've got a couple other opinions. 😉

  1. Remove the spotlight affect. Just show all the text at the same level of opacity.
  2. Remove the breadcrumbs if you haven't already.
  3. I know it's significant, but you may even drop the blue + icon next to the W because that can be achieved with the /.

Ultimately, you'd end with something like this:

writing

@youknowriad
Copy link
Contributor Author

Remove the spotlight affect. Just show all the text at the same level of opacity.

I know @mtias cares about this a lot and argued against it. I think this effect is useful especially when you strip out theme styles, otherwise, it might not give the expected result.

@youknowriad
Copy link
Contributor Author

I know it's significant, but you may even drop the blue + icon next to the W because that can be achieved with the /.

I can be onboard with this personally.

@jasmussen
Copy link
Contributor

Before opening the PR, I was wondering whether we'd need granular options (hide undo, hide navigation, disable editor styles) and the realization is that we probably need both.

I'm coming around to this one. If we really do want to go the route of "focus mode is writing mode", then we should actually offer a range of options just for the writing experience.

@youknowriad
Copy link
Contributor Author

I think there's a wide range of opinions about what we should consider for this mode, I'd like us to find the MVP here that is both useful and not hard to implement to get the ball rolling. That's the intent of the proposal here.

@jasmussen
Copy link
Contributor

'd like us to find the MVP here that is both useful and not hard to implement to get the ball rolling

Right at this moment (I'm very tired) I feel like maybe removing the editor style is part of that mvp. It would visually very clearly indicate: this is intended for writing, not building your page.

@mapk
Copy link
Contributor

mapk commented May 28, 2020

I feel like maybe removing the editor style is part of that mvp.

I like this.

I know @mtias cares about this a lot and argued against it.

I hear ya, but this feels more like a writing mode now in which case the spotlight treatment doesn't seem useful. I'd argue that it's not necessary in this mode. It's the UI that needs reduction, not the content.

Pushing for an MVP is great! If that means sticking with your original prototype, let's do that. BUT I agree we should drop all theme styles here, and I'd still push for removal of spotlight treatment.

@youknowriad
Copy link
Contributor Author

youknowriad commented May 28, 2020

Thanks for the feedback, I'll be back at this shortly and I'll try to remove the editor styles.

@mtias
Copy link
Member

mtias commented May 28, 2020

Thanks for exploring this. I believe there's a lot of potential for this mode, but it would be hard to make assumptions over everyone's preferences for what "focus" or "zen" is. I was contemplating having a section in "settings" that would let you configure the focus mode a bit. I think Ulysses and other writing apps do this very well, where things are encapsulated in a single toggle but there are also some settings to control behaviour once you switch to the mode.

For example, this is sentence highlight from the "typewriter" mode:

image

Which is controlled as a sub-setting of what they call "typewriter mode":

image

We have typewriter-scroll built in, but it'd make sense to decompress "focus" mode into a few relevant settings:

  • Reduced UI (no toolbar, outlines, etc)
  • Spotlight (highlight current block)
  • Dark / Light

In the future, we might be able to also use the inter-block partial selection as the default behaviour in this mode (cc @ellatrix)

The model of a settings group for "focus" is something I think we'd also need for some accessibility characteristics (like always showing block outlines, disabling writing flow, etc).

@mtias
Copy link
Member

mtias commented May 28, 2020

But if we go toward a WRITING MODE, I've got a couple other opinions.

I think we should be opinionated with this one :) Dropping the + is interesting, I think we should try it. I'd still probably encapsulate that in a "reduced interface" checkbox.

@youknowriad youknowriad force-pushed the try/more-opinionated-focus-mode branch from f0a1141 to f71fd50 Compare May 28, 2020 11:33
@youknowriad
Copy link
Contributor Author

youknowriad commented May 28, 2020

I pushed some updates here and I used separate options on the "Options" modal to get a better feel for every one of these options:

  • Reduced UI: removed a lot of UI and toolbars
  • Theme Styles: Enable/disable theme styles
  • Spotlight mode: Focus selected block

Known issues

  • Some themes bypass editor styles and just load their CSS on the editor for some of their styles. For instance, in 2020, the background is not an editor styles. Having this mode will encourage these themes to do it the right way. (Outside of the scope of this PR)
  • When toggling between with/without editor styles, the height of the "title" could change but there's a bug in textarea autosize and the size won't adapt properly in some cases. (A refresh or typing in the input rerenders properly). The ideal fix here is to replace the PostTitle input with the post tilte block. (Outside of the scope of this PR)
  • Our default styles (no theme styles) are not great. This will encourage us to think about these more.

@folletto
Copy link
Contributor

folletto commented Jun 3, 2020

One thing I'd add to the discussion is that for a lot of people "writing mode" would be enough, compared to a full on "focus mode". This is mostly due to the over-bearing UI that blocks bring in to the writing experience.

I want to clarify this point just to highlight that there are three modes (block, writing, focus) not two (block, focus).

  • Block: current fully editorial layout experience, rich editing
  • Writing: focus on text, yet still all options as in a good editor, but no blocks admin debris
  • Focus: get rid of everything, literally just me and my text

This is a note that transcends a bit the specific details on how we achieve it, and the detailed settings for each of the options.

@mtias
Copy link
Member

mtias commented Jun 4, 2020

@folletto not sure I'd classify it as three modes like that as a few things traverse the experience horizontally. For example:

  • Select and Edit (the top level cursors) define explicit interaction modes.
  • When the user types we engage on "isTyping" which is a writing mode that is present on all modes.
  • Top Toolbar is often compared to a "writing mode" as well since it consolidate tools into the more traditional pattern of text editors.

I think perhaps a way to simplify things would be to have a toggle "Writing Mode" that can have configurations for things that are currently spread between top toolbar, highlight settings, etc.

@folletto
Copy link
Contributor

folletto commented Jun 4, 2020

I agree, these aren't necessarily modes per se. I think these are more "User attitudes", that can be satisfied with different approaches. The example you make is solid: "Top Toolbar" fulfils in part one of the modes without being explicitly "that" mode. :)

In short: if we keep in mind these three user attitudes when approaching these configuration variables, I think it sets us up to do a good job :)

@mtias
Copy link
Member

mtias commented Jun 4, 2020

Right, agreed :)

@youknowriad I think we should try dropping the bottom border on .interface-interface-skeleton__header

@youknowriad
Copy link
Contributor Author

@youknowriad I think we should try dropping the bottom border on .interface-interface-skeleton__header

I guess also using a "transparent" background for the header too.

@jasmussen
Copy link
Contributor

Transparent would get messy when you scroll. Can try a semi transparent background, but even just removing the border can work.

@youknowriad youknowriad changed the title Try a very opinionated spotlight mode Add more writing flow options: Reduced UI, theme styles, spotlight Sep 24, 2020
@youknowriad
Copy link
Contributor Author

The options need to be better organized than the current state but we need a better design of that modal first. It's being tracked here #24965

So what do you think about shipping the first iteration of this PR?

@mtias
Copy link
Member

mtias commented Sep 24, 2020

I'm not super keen on the name reducedUI used throughout

@youknowriad
Copy link
Contributor Author

@mtias what should it be instead. It can be "Light UI" as well, we can also add a help text explaining what it does.

@jasmussen
Copy link
Contributor

"Compact UI" might be better.

This is what I see:

focus

I'm trying this branch fresh on a new install, and I was surprised to see my theme font missing. It seems like loading theme styles should be on by default, right?

Also, if spotlight mode moves to options (I'm a fan!) it can be removed from the top of the more menu, right?

I'd also sort "Theme styles" at the top, and upon landing the ability to turn them off, I would super bump the priority of redesigning the base styles. Noto Serif has not aged well at all, and I'd love for us to find an alternative, even if it means system fonts throughout :D (-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif).

@youknowriad
Copy link
Contributor Author

Also, if spotlight mode moves to options (I'm a fan!) it can be removed from the top of the more menu, right?

yes, probably but the same could be said for "top toolbar" or "full screen mode". I wanted to avoid doing that until we have a good design for #24965

@youknowriad
Copy link
Contributor Author

I enabled the theme styles by default and renamed Reduced UI to "Compact UI".

@pablohoneyhoney
Copy link

I believe some of these focused affordances could live under "Spotlight", with distinct configurations (spotlight on the block, spotlight on the action).

This requires some work with the taxonomy. For the short term, "Focused Mode" works better semantically.

@ZebulanStanphill
Copy link
Member

I definitely think the 3 "View" options should all be moved into the "Options" modal. They're all "set it and forget it" preferences. Once you set them, you're unlikely to change them, so after their initial use, they're just wasting space in the ellipsis menu.

I'm not convinced "compact" is the right term to use here. I would think that such an option would shrink the toolbar size or something like that. I wouldn't expect it to hide controls. Why not just call the option "Show fewer controls" or something like that to tell users exactly what the option does without them having to guess?

@paaljoachim
Copy link
Contributor

I am testing the PR using Twenty Twenty and http://localhost:8888/
Going to the Sample Page I see this.
Notice the quote blocks are located further to the left in comparison with the paragraph block.

Screen Shot 2020-09-28 at 08 32 15

I open Options.
Screen Shot 2020-09-28 at 08 33 04

(Nb. Change "Commpact UI" -> "Compact UI")

I Click Commpact UI and notice that many of the top toolbar icons and the bottom breadcrumbs is hidden.

Screen Shot 2020-09-28 at 08 35 01

The big black square with the W in it top left takes a lot of the visual attention away from the rest of the screen. Should it also be hidden? Which means to get back to the wp admin one needs to turn off full screen mode, or perhaps use the browser back button.
Screen Shot 2020-09-28 at 08 36 58

Here is what it looks like without the black square.
Removing-black-W-square-Writing-mode

@youknowriad
Copy link
Contributor Author

2020 is not a good theme to test with because it doesn't implement the editor styles properly (using the official API). For the "W" button I'm not sure we should change that unless we find a way to avoid being blocked in the editor screen.

@youknowriad
Copy link
Contributor Author

I also aknowledge that the options organisation is probably not the best but i'd like for us to discuss this in #24965 and not block this PR. I expect the discussion to have very varying opinions and might require some design changes before moving to implementation. My hope is to land this as is with potentially some light wording changes.

@paaljoachim
Copy link
Contributor

paaljoachim commented Sep 28, 2020

Regarding the W. The mockup from @mapk here: #22494 (comment) where the W does not contain the black background will very much help.

Screen Shot 2020-09-28 at 10 28 10

Iterating on options is another PR. It is nice to just keep this PR focused on the writing/compact ui mode.

featureName="focusMode"
label={ __( 'Spotlight' ) }
/>
</Section>
Copy link
Member

Choose a reason for hiding this comment

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

That's a lot of options. Why not merge with spotlight?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one place where we can't make decision in behalf of the user IMO. Someone might want the spotlight effect combined with the top toolbar while someone else might want to remove the theme styles, use an inline toolbar

Copy link
Member

Choose a reason for hiding this comment

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

Let's see if we can get to a better "preferences" UI next: #24965

$editor_styles_file = gutenberg_dir_path() . 'build/editor/editor-styles.css';
$settings['defaultEditorStyles'] = array(
array(
'css' => file_get_contents( $editor_styles_file ),
Copy link
Member

Choose a reason for hiding this comment

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

Did we previously not use these styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have a way to get just these styles, previously we just received an array containing the editor styles the theme wants, it can or can't include these.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we handle file-access failures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is already loaded that way in Core and in other places in Gutenberg, so I'm not sure we need special treatment here.

packages/edit-post/src/editor.js Outdated Show resolved Hide resolved
$editor_styles_file = gutenberg_dir_path() . 'build/editor/editor-styles.css';
$settings['defaultEditorStyles'] = array(
array(
'css' => file_get_contents( $editor_styles_file ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we handle file-access failures?

} = select( 'core/block-editor' );
const { hasReducedUI } = getSettings();
if ( hasReducedUI ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isInserterHidden seems to only affect a classname. Is it the best way to hide?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was intentional to keep it in the tab sequence (show it when you tab into it)

@youknowriad youknowriad merged commit e61483b into master Oct 2, 2020
@youknowriad youknowriad deleted the try/more-opinionated-focus-mode branch October 2, 2020 09:52
@github-actions github-actions bot added this to the Gutenberg 9.2 milestone Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Interface Parts of the UI which don't fall neatly under other labels. Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet