-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block editor: move is-navigate-mode class to WritingFlow #19868
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this is the right place for it.
If this is applied at this level, should the navigation styles be moved to the WritingFlow as well? For me ideally, this shouldn't be applied here unless the navigation mode is triggered here as well.
If the navigation mode is triggered from the block list (talking about the shortcuts), then maybe the style should stay where it is now but the class should also move to the BlockList.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which shortcut are you talking about? This component contains almost all logic for navigation mode (except for the breadcrumb to go back into Edit mode). It's used as the container to control the mode, so I feel like this component is appropriate for the class as well. I do agree that perhaps the CSS selectors should be moved as well, but I wasn't 100% sure about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about "Enter" to enter "edit" mode and "Escape" to enter "navigation" mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ellatrix As an aside, I have a concern about all these refactorings we're doing to make the block.js smaller (classes and behavior). We often think about the Gutenberg use case in Core but we forget/neglect the packages and their reusable aspect. We should be making more playground stories to ensure we don't regress in these use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escape
to enter navigation mode is added byWritingFlow
.Enter
to enter edit mode is added by the breadcrumb within the block toolbar. SinceWritingFlow
forms a container around the blocks, it seems the most appropriate for the class (as opposed to the breadcrumb). I feel like the block and block list components don't have much to do with the mode other than some minor styling difference (which will even be removed in the future it seems).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I'm neglecting the packages here. Previously
WritingFlow
already handled a lot of navigation mode, so without it, it would be broken.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not blaming you or anyone :)
I know I have a tendency to forget about the playground and third-party usage sometimes and when I see things that could break that in other PRs, I wonder if I might not be the only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know :) It's good to raise this. Perhaps we should add some tests for using the block editor on its own. I'll have a look into it at some point. That said, I don't think this PR in particular would break anything. If
BlockList
is used on its own, you can't really use navigation mode withWritingFlow
. IfWritingFlow
is added, the class will be there as well.