-
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
Show "none" as an alignment option and use contextual text to clarify settings #34710
Conversation
Size Change: +4.71 kB (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
); | ||
} ) } | ||
</MenuGroup> | ||
{ ! wideAlignmentsSupport && <div>{ help }</div> } |
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 will also need polishing like the tag
to render and styles.
Nice work! I see some CSS variables output here: We need to do the icon changes as well. The existing "block-alignment-center" icon should be repurposed as the new "none" icon (in other words, renamed in the npm library). And then we add a new center icon, this one:
Nice work! |
Perhaps to explain what's going on — I have this in my theme.json. It might pose a challenge for us 🤔
What, if anything, can we do here? Is referencing CSS variables inside theme.json something we should never do? |
Added a Figma label as a reminder to myself. |
Maybe it won't be that hard to parse: |
packages/block-editor/src/components/block-alignment-control/ui.js
Outdated
Show resolved
Hide resolved
With this being merged: #21892, do we want to have the |
7ccdc69
to
ae1eb5e
Compare
You mean when the dropdown is open? |
No, when it's closed. Now I've kept it highlighted in the |
This also fixes #30782. |
I don't think that is something we shouldn't do, but would like some thoughts from @oandregal or @jorgefilipecosta |
Ah, yes, that makes sense. I think none of the alignments should have a toggled state when resting on the toolbar? Only on the dropdown. cc @jasmussen |
It's fine as long as the CSS variables used are the ones we generate/control via We have tools to parse the var to the actual value in the |
88b64d3
to
1122d01
Compare
I guess if this PR is ready to merge we can just include a temporary solution using some of the code here and then we refactor this way we keep both PR's moving without blocking each other. |
a655d57
to
a3932db
Compare
I guess some good code review and maybe some rethinking about:
|
@@ -39,7 +55,8 @@ const BLOCK_ALIGNMENTS_CONTROLS = { | |||
}, | |||
}; | |||
|
|||
const DEFAULT_CONTROL = 'center'; | |||
const DEFAULT_CONTROL = 'none'; | |||
const help = __( 'Wider alignments are not available.' ); |
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 actually think this message is not helpful at all, because it can confuse the user in assuming that wide alignments are not available anywhere while they are container-dependent.
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.
The copy
of this is not finalized: #34597 (comment) and IMO we could definitely could omit that here and add it in a follow up..
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 in the opinion that we shouldn't add it at all but 🤷♂️
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 is for cases like within a column where wide doesn't make sense? Let's skip showing anything there. We should only show a message on container where wide/full could be supported but are not.
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.
@mtias is it okay to skip in this PR? I think it needs more thinking and could be added in a follow up - especially if we try to add some logic to find if a block is a container or not.
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.
Sounds good
packages/block-editor/src/components/block-alignment-control/ui.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-alignment-control/use-available-alignments.js
Outdated
Show resolved
Hide resolved
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 is looking good in general, I left some small comments.
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 wonder if it's worth keeping the "toggling" behavior (meaning clicking the same alignment to unset it) but regardless, it looks good.
Testing.... Media & Text block Alignment-none.mp4Works nicely! I also tested with columns block with 3 columns inside a Group block. This also worked nicely! Great work! |
Thank you all for your help and feedback! |
Hey @ntsekouras. 👋🏻 Unfortunately, these changes introduced a regression for the native rendering of |
Oh shoot... Looking at the PR right now!! Thanks @dcalhoun ! |
Description
Resolves: #34597
Fixes: #30782
This PR is for now a rough POC to update the design of the alignment dropdown to include "none" as an option (it's the same as unsetting). The center icon has been updated, and the previous icon for centering has been repurposed for indicating "None". There's help text for "None" and "Wide", to show the values for the content and wide area layout values.
For themes that do not support wide or fullwide alignments we render some contextual text to clarify the missing buttons:
-- the above description is from the issue
Testing instructions
layout
(likett1-blocks
) insert aHeading
in a postGroup
and change thelayout
's widths (content
andwide
)Heading
inside thisGroup
alignment control options
in bothHeading
blocks.In general I will need help with testing to find out missing functionality/info, especially from folks experienced in themes.
Tasks / Notes
wide alignments
are not supported.wide alignments
are supportedwide and content
widths from somewhere else besideslayout
?ToolbarGroup
) is affected somehow or needs changescenter
icon with the new oneuseAvailableAlignments
intact and incorporate a new helper hookNotes
align
tests also made sure that work as expected intt1 and tt1-blocks
as the button context changes. I didn't add to run on both themes though.. Should we run these for both themes? 🤔