-
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
Update document title position so that it's centrally aligned #59078
Conversation
Size Change: +41 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 19f6b5b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7917191394
|
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.
Thanks for the PR!
I think the tricky part about this issue is that the header buttons on the right side can be extended by plugins.
For example, if you run the code below in the browser console, overlapping will occur depending on the width of the browser.
for (let i = 0; i < 4; i++) {
wp.plugins.registerPlugin( 'my-plugin-sidebar-' + i, {
render: function () {
return React.createElement(
wp.editSite.PluginSidebar,
{
name: 'my-plugin-sidebar-' + i,
icon: 'admin-post',
}
);
},
} );
}
724d6bb630990745f6ca65c57779409a.mp4
In reality, such cases are unlikely, but I think edge cases like this need to be considered as well.
One of my ideas is to put the header row in a grid layout without changing the document title to absolute alignment.
.edit-site-header-edit-mode {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
However, simply using this approach may result in unintended layout disruptions.
Or perhaps we could dynamically calculate the left and right margins of the header row to make the document title bar's width variable.
@draganescu As I recall, you were working on dynamically calculating the width of the header toolbar. Have any ideas?
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Sirjazzfeetz. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
The grid approach could work in theory, so long as we offset the title by |
I recently explored this as well in #59134; was finally annoyed enough by it. I went the flex route. |
@richtabor that seems to work well! |
Closing this. Rich's approach works better. |
Fixes #29673.
What?
Align the document title centrally in the viewport.
Why?
See #29673.
How?
On large viewports (
xlarge
breakpoint) absolutely position the container then offset usingtransform
.Testing Instructions
Screenshots
Top is trunk, bottom is this PR. The red line represents the center point.