-
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
Global Styles: Prevent Unwanted ItemGroup List Rendering in Border Panel #68633
base: trunk
Are you sure you want to change the base?
Global Styles: Prevent Unwanted ItemGroup List Rendering in Border Panel #68633
Conversation
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. |
@im3dabasia thanks for your PR. Apparently, ItemGroup has been used here only to implement a design for a bordered gray button, which is also inconsistent with the Button component default style variants. To me, this usage is entirely wrong under all aspects, also from a design perspective because it introduces one more button styling that is inconsistent and just overrides the default styles. As a quick fix, I have no objections to add |
@@ -298,7 +298,7 @@ export default function BorderPanel( { | |||
</BaseControl.VisualLabel> | |||
) : null } | |||
|
|||
<ItemGroup isBordered isSeparated> | |||
<ItemGroup isBordered isSeparated role="none"> |
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 suggest to add an inline comment // TODO:
to explain why this role none is used here, as a temporary fix. There are a few examples of todo comments in the codebase for inspiration.
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.
See comment.
We on @WordPress/gutenberg-components don't currently have much time to dedicate to work on Gutenberg, but my recommendation would be to keep changes to the original component to a minimum (ideally avoid them), and instead gather info to inform the next iteration of the component (#64445) |
Is there any reason why we couldn't simply refactor it to use a We're doing a similar refactoring in #68672. There's also a proposal to abstract such components, by the way. See #68973 (comment). |
Ideally, yes. To me, one of the main reasons of components being used incorrectly is because design wants a new styling for Buttons or other components.
The above isn't to blame individuals. Rather, as I mentioned a few times, I think the process should be improved to prevent such incorrect usage of components. Also, reviews should be more thoughtful. That said, yes this should be a Button component. I'm not opposed to a temporary fix. A more long term fix should be improving the base components to allow the desired design or, alternatively, reconsider the design to work within the constraints of what the base components provide. |
I agree that the current implementation is not ideal, but I don't think it's necessary to solve everything at once. What is required in this PR? In my opinion, replace it with the It will require some overrides with custom styles (gray border), but I think improvements to the |
I think the whole point here is that Design should not implement stylings that aren't provided by the base components. This design trend in this project entirely defeats the purpose of having a library of reusable, consistent, tested, and accessible components. I'd rather change the design here and avoid any custom styles / CSS overrides. |
Does this mean we pause this PR and add an API to the |
Dropping in with some quick thoughts:
|
@ciampo I think you are missing the point here.
It's not a list actually. It's a broken list. The equivalent in HTML would be as the following examples explained in the issue: An
A button that contains an
Both are not acceptable from a semantic perspective and if this was coded in HTML it would be more evident that it's, I would say, embarrassing and unprofessional HTML. I'm not saying that lightly. My point is that if the design wants to achieve some custom styling (which is already arguable to me), the implementation should not hack around base components and use them incorrectly. Instead, if these nrew styling are really necessary they should be implemented in the base components as that's the only way to guarantee a consistent UI, maintenance, and avoid bugs. Otherwise, these custom design should simply not be implemented. |
I missed that — and how difficult would it be to add an (sorry for not being able to verify that on my end, I just don't happen to have much time on my hands these days) |
Part of: #67425
What?
Revised
<ItemGroup>
to userole="none"
and prevent it from rendering an unnecessaryrole="list"
when it is not semantically required.Why?
Avoids adding unwanted list roles where a semantic list is not necessary, ensuring accessibility standards are maintained without enforcing unnecessary constraints.
How?
Updated
<ItemGroup>
to includerole="none"
and an optional as prop for flexibility. Removed instances ofrole="list"
where a list structure wasn't required.Testing Instructions
Screenshots or screencast
Before
After