-
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
Writing flow: allow select all from empty selection #33446
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7dd849b
Writing flow: allow select all from empty selection
ellatrix dd7f1f6
Simpler tax index
ellatrix 894848d
Forward ref
ellatrix c8b3a2d
Fix e2e test: enter nav mode when tabbing inside the canvas and no bl…
ellatrix e72dabb
Add e2e test
ellatrix ee244e9
Writing flow: prevent default on Esc keydown for nav mode
ellatrix 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,13 +57,14 @@ function MaybeIframe( { | |
return ( | ||
<> | ||
<EditorStyles styles={ styles } /> | ||
<div | ||
<WritingFlow | ||
ref={ contentRef } | ||
className="editor-styles-wrapper" | ||
style={ { flex: '1', ...style } } | ||
tabIndex={ -1 } | ||
> | ||
{ children } | ||
</div> | ||
</WritingFlow> | ||
</> | ||
); | ||
} | ||
|
@@ -75,7 +76,7 @@ function MaybeIframe( { | |
contentRef={ contentRef } | ||
style={ { width: '100%', height: '100%', display: 'block' } } | ||
> | ||
{ children } | ||
<WritingFlow>{ children }</WritingFlow> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, writing flow behaviour will be set on the iframe body element. |
||
</Iframe> | ||
); | ||
} | ||
|
@@ -234,18 +235,14 @@ export default function VisualEditor( { styles } ) { | |
layout={ defaultLayout } | ||
/> | ||
) } | ||
<WritingFlow> | ||
{ ! isTemplateMode && ( | ||
<div className="edit-post-visual-editor__post-title-wrapper"> | ||
<PostTitle /> | ||
</div> | ||
) } | ||
<RecursionProvider> | ||
<BlockList | ||
__experimentalLayout={ layout } | ||
/> | ||
</RecursionProvider> | ||
</WritingFlow> | ||
{ ! isTemplateMode && ( | ||
<div className="edit-post-visual-editor__post-title-wrapper"> | ||
<PostTitle /> | ||
</div> | ||
) } | ||
<RecursionProvider> | ||
<BlockList __experimentalLayout={ layout } /> | ||
</RecursionProvider> | ||
</MaybeIframe> | ||
</motion.div> | ||
</motion.div> | ||
|
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.
How is this related to this PR? What's the purpose of this change?
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.
It is needed to make e2e tests pass. We enable navigation mode when the user tabs into the writing flow focus capture, but with tab index set to
-1
and when clearing block selection, focus will no longer move to the interface content element, but rather to the editor styles wrapper. When tabbing, it will not go through to focus capture to enable navigation mode, so we have to enable navigation mode when the user tabs in the content and there is no block selection.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 follow here, why do we need to auto-enable navigation mode implicitly (not hitting "Escape").
If there's no block selected and we tab into the content, can't we just select the first 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.
We could, but that's not how the behaviour was. I want to preserve the current behaviour. This was discussed once with the some people from the accessibility team that if no block is selected, and you tab into the content, the editor should be in navigation mode to select a block. Supposedly it wouldn't make sense to decide for the user and pick the first one from which they then have to press Esc to pick another one. But all of this is a bit more opinionated, so for this PR I just want to make the tests pass and not change the current behaviour. :)
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 didn't know this was the current behavior, that's fine by me.