-
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
Fix incorrect usage of ItemGroup in the Image block filters panel. #67513
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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 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. |
Size Change: +7 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
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 also contains a fix for the Item height new default of 40 pixels when it is rendered as a Button. This part is mainly for demoing a potential way to fix the size but I'm not sure it should be addressed this way. After crafting this PR I discovered the size issue is tracked in #46741 and should be better addressed there. I'm glad to revert the size fix in this PR, just submitting as is so far, pending feedback.
I would personally leave the height changes for another PR. The ItemGroup
component doesn't currently set any height at all, and I would prefer to keep it that way for the time being.
We should discuss this aspect in #46741, and potentially even decide to apply the sizing changes only when implementing the re-design discussed in #64445.
I wonder if we could do something like this (cc @mirka ):
const CustomButtomItem = ( props ) => (
<Button __next40pxDefaultSize { ...props } />
);
// Later in code
<Item as={ CustomButtomItem } { ...toggleProps }>
@@ -189,15 +189,16 @@ export default function FiltersPanel( { | |||
|
|||
return ( | |||
<ItemGroup isBordered isSeparated> | |||
<Button | |||
<Item | |||
as="button" | |||
__next40pxDefaultSize |
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.
Does it even need this 40px size handling anyway? I'm seeing that the button is already pretty much the correct size (40px minus border widths = 38px) due to these styles. I might be missing something.
__next40pxDefaultSize |
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.
Yes I noticed it's 38px + the borders. It's incorrect anyways.
I have no strong opinions, I can remove the __next40pxDefaultSize
tempative fix, as I mentioned it was for demoing a potential way to fix it. I'd like to prevent designers complain about an incorrect height :)
As an aside: if some designs want buttons with a grey border, then it should not be implemented with local overrides or incorrect usage of components such as by using Buttons should only use the variants of the base button component. If a new vaariant is desired, it should be considered t obe implemented in the base component. |
b34462f
to
02723d9
Compare
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 looks good overall 👍
One little thing I noticed that might need some work is the weird double bottom border we're getting sometimes:
To repro this, I do the following:
- Click, but don't release the "Duotone" item
- Drag the mouse outside
- Drop anywhere
In this PR, I see the double border. On trunk, the item remains focused. I think keeping it focused makes sense.
@tyxla thanks for your feedback.
The difference you are seeing in the focus indication comes from the fact that in this PR the Instead, on trunk it's a Button component, which uses :focus.
It's an inconsistency in the focus indication between the Button component and ItemGroup as a button element which is outside of the scope of this issue. I think this has been implemented intentionally, but I'm not sure it's a good thinkg. I'll create a separate issue to consider making this behavior consistent. |
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 @tyxla for your review. |
@WordPress/gutenberg-core I guess it's okay to merge despite the two native tests being canceled because of the macOS-12 environment deprecation thing? |
f6d8c69
to
288343e
Compare
Yeah, those have been failing on all PRs recently. |
Yes, I read the conversation on Slack, just wondering whether a fix was coming soon. Will merge. Thanks. |
Not really a fix, but we're skipping them temporarily in #67799 |
See #67425
What?
The
<ItemGroup>
component should only contain<Item>
sub-components as it's intended to render alist
withlistitems
. This quick PR aims to fix one incorrect usage.It also contains a fix for the
Item
height new default of 40 pixels when it is rendered as a Button. This part is mainly for demoing a potential way to fix the size but I'm not sure it should be addressed this way. After crafting this PR I discovered the size issue is tracked in #46741 and should be better addressed there. I'm glad to revert the size fix in this PR, just submitting as is so far, pending feedback.Cc @WordPress/gutenberg-components
Why?
Components should render semantic markup.
How?
Uses the missing
Item
sub-component, as a Button.Testing Instructions
role="listitem"
which in turn is wrapped within a div element withrole="list"
.Testing Instructions for Keyboard
Screenshots or screencast