-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor the layout component to separate the UI from the content. #18044
Conversation
ab9eb62
to
80c0eac
Compare
95ccda2
to
4b3d24e
Compare
This seems very solid. Works well for me in all horizontal breakpoints, with and without sidebar. However there are a couple of issues to solve, first one is easy: Fullscreen has extra topmargin. Another small one is the sidebar doesn't extend to the bottom: The bigger issue is related to the navigation sidebar, and is visible in a number of situations:
The left sidebar does not scroll. This is a frustrating issue, because you'd think you could just add Which means there are only really two ways of fixing allowing the left menu to have flyouts, and scroll. One solution is in This is not a very elegant solution, but the only other solution is to refactor the left navigation menu to not use flyouts, such as is proposed in https://core.trac.wordpress.org/ticket/47012. |
4fdf2e4
to
40aeafb
Compare
4f650d3
to
b409aa5
Compare
This seems to be working well and generally makes sense to me. The set of structural dependencies looks a bit weird, though — should the I could imagine possibly making our exports reflect the dependency: |
So yeah, right now the EditorRegions component is editor specific and contains the aria region names. Ideally, it becomes more flexible to allow it to be used outside the I think this PR is the first step in that direction, the API to make it more generic can be thought of separately. |
Let's test this as soon as possible to detect any possible regressions. |
@@ -1,21 +1,6 @@ | |||
.edit-post-layout, | |||
.edit-post-layout__content { | |||
height: 100%; |
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.
This one could be the cause of #18044 (comment).
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.
This CSS appears to fix the issue:
.edit-post-visual-editor {
height: 100%;
}
But this div also happens to be editor-styles-wrapper
, and I'm not sure any heights should be applied there?
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.
This seems like a good fix to me, It was like that before so I don't see a reason for it to be a problem.
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.
Want me to PR?
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.
PR'ed: #18687
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.
Thank you
I think this PR might have regressed the z-index location. It's now in the top left corner: However #18732 might fix it. |
It's already fixed in master |
</FocusReturnProvider> | ||
<FocusReturnProvider className={ className }> | ||
<EditorRegions | ||
className={ className } |
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.
Is it necessary that className
be applied on both the FocusReturnProvider
and EditorRegions
elements?
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.
No, it's unintentional
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.
While working on #17838 I noticed that it's very hard to work on the Layout of the Editor.
The fact is there are so many things to think about:
...
These create different constraints that are spread across different components in our code base and also mixed with a lot of unrelated items.
In this PR, I'm basically splitting the
UI
and the editor regions out of theLayout
component. The idea is that the newEditorRegions
takes care of how things are displayed on the screen (sidebar, main area, header, footer), gives a name and enable aria region navigation for these different areas and theLayout
component fills the different regions for content.A nice side effect here is that all these layouting constraints are now constraint in a single stylesheet making it very easy to maintain and reason about.
This change may have some impacts on classNames, zIndex, browsers so it needs to be tested properly but I'm hoping that it makes our code way more manageable.
The new
EditorRegions
component can also be easily made more flexible (allowing different names for the regions) and shared with other screens (Widgets...)Thoughts?