-
Notifications
You must be signed in to change notification settings - Fork 4.6k
DataViews: Try using 24px padding for consistency across different uses #73334
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
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. |
|
Size Change: -1.24 kB (-0.05%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
| padding-inline-end: $grid-unit-30; | ||
| } | ||
| /** | ||
| * When DataViews are placed within modals, apply a consistent padding to match the header. |
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.
Where does 10px come from?
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 just updated the comment — this was an AI generated comment that thought $grid-unit-10 was 10px. I missed the typo when I was skimming over the changes!
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.
For the modal case, this is a bit hacky. The padding rule here is included to get it to line up with the modal header. It's not the worst it could be as it's only a single rule, but still not very neat 😅
IMO it seems like it, or adjust some other css in site editor to add the extra padding to look like in trunk. |
I guess this is the drawback with this approach, we're still forced to add custom css to make DataViews behave as we want in certain circumstances. I agree it's not that intrusive, but it doesn't seem very scalable. We can't add these special rules for all combinations. |
That's a good point. But how many combinations do we think we'll need to handle, and is it worth it to attempt to codify that just yet? I guess what I'm curious about is: how do we make a pragmatic decision in the shorter-term to a) make DataViews look acceptable in modals, while b) simplifying the CSS without creating too much of a backwards compatibility headache. I don't think this PR is perfect by any means, but is it a reasonable step in the direction we'd like to go in? Or to put it differently, is it proposing a change that's going to make things harder for us further down the track? Happy to try out any other ideas, too. My gut feeling is that we should probably go with a pragmatic fix in the shorter-term, and accept that we might need to refactor these rules again further down the track when we've got a clearer idea of how we'd like to handle theming for these kinds of components 🤔 |
I'd also like to know the stakes are. That is, what do folks need right now vs what can be adjusted later when we have more information about the cases we need to cover? As far as I can see, the scalability concern is valid, but context-specific overrides already exist (Card, Modal), and this simplifies the base padding while improving Modal appearance. |
|
Modals are one example, Cards are another. Obviously we can't control how third party consumers compose things. Someone might want to place a DataViews instance in their own custom container component... In such a scenario it would ideally 'just work'. That makes me biased toward finding the solution that will make dataviews as portable as possible, with as little consumer effort as possible. I remain drawn to the 'no padding' approach, mostly because it's simplest. But if we're not satisfied with that then I think making the padding configurable rather than adding a bunch of styles to handle specific use cases would be preferable. I suppose that's the approach you were working on in #72989 :) |
|
Thanks for the feedback on this one, folks! I'll close this out in favour of #72989 which seeks to make padding customisable while maintaining backwards compatibility for components not setting a |
|
I'm just re-opening this PR to flag that it's still under consideration as one of the (many) options for addressing padding. |
6930bb7 to
48b3a4c
Compare
|
One more thing :) I realised this issue is basically the exact same problem we faced when |
There should be no gap added by the @jameskoster I see you care a lot about removing the padding entirely from DataViews. I personally still think this is a design decision but my hunch is that you may be misjudging the potential impact (on existing users of DataViews). Regardless, the current PR doesn't change the statusquo, it just makes things mode clear, remove useless container queries and makes things more consistent. So we should ship it and it wouldn't impact the decision about whether we remove all the padding entirely later from DataViews. So I propose that we merge this as is. And we continue exploring padding-less dataviews, which if it works design wise has my preference because there's no potential flexibility that creates misusage. |
|
Yeah I was thinking I might resurrect the zero-padding PR to explore further. But I agree it doesn't need to prohibit merging this one first. Before we do I would appreciate a final confidence boost from @WordPress/gutenberg-design about reducing Modal padding from 32px to 24px, and obviously fixing the alignment issue noted in this comment. |
…n allow DataViewsPicker to go edge-to-edge
74792b7 to
8bd5892
Compare
|
Thanks folks! I've rebased again and pushed a small fix for the patterns modal. Its sidebar uses Here's how it's looking now:
I notice that the padding of the header of the modal does look a little large. It's a similar problem to this topic:
For the case of the pattern explorer at least, things get interesting when you scroll down the modal as this PR looks neater than trunk in that situation. It appears that trunk has a smaller padding-bottom on the header to compensate, but it can look a bit awkward. Here's how things look when scrolling down a modal (this PR wins out): This PR
Trunk
Yes. For me this problem is similar to the rest of the discussion surrounding customisability, which is to say, these discussions are important and touch on so many points that are worth digging into and resolving. My preference would be to do all this work in small(er) iterative stages. I'm imagining that first, we merge this PR to standardize on Overall, I'm really pleased to see everyone so engaged in this topic! I'm aware that this is still a breaking visual change (albeit a relatively small one), so it's hard to reach consensus here:
Yes, I'd love to feel confident in landing this one. Please do raise any concerns if anyone thinks we shouldn't land this PR. Otherwise, I'll aim to merge this in, in around 24 hours. Thanks again, all! |
|
I'm going to push the button here :) you know, nothing is frozen :P |
|
It seems this PR introduced unintended padding into the global styles sidebar, which is probably where this is relevant. This PR appears to have introduced unintended padding into the global styles sidebar. These sections are likely related to the issue:
Here are some examples of the issue: |
|
Oh, good catch @t-hamano! I can put up a PR later on today for that. |
|
@t-hamano I've put up a revert for the changes to the Global Styles UI areas over in #73834. It looks like those changes also rolled out FYI @youknowriad in case you wanted to keep them (we can always look at bringing those changes back after the revert, of course) |
|
The Global Styles changes were intentional because I wanted a coherent padding for global styles both in the styles panel and in the styles page. But I'll check in your linked PR. |
…3334 (#73834) Co-authored-by: andrewserong <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: juanfra <[email protected]>









What?
Closes #72336 (in the event that this lands — this PR is fairly speculative)
Try updating DataViews (and DataViewsPicker) to use
24pxpadding in all circumstances.Why?
As discussed in #72336, DataViews can look a bit awkward in a number of different circumstances (used within Card, used within Modal) due to the DataViews padding. But it's also hard to change the padding in a way that doesn't adversely affect existing usage, and that doesn't add complex APIs (like configurable padding).
The idea in this PR, based on this discussion is to see if we can standardize on
24px. There's a few reasons why:24pxin narrower container sizes, so if we settle on24pxin all cases, we can simplify some of the CSS24pxwhen displaying within a Card, so this allows us to simplify the Card CSS24pxgets us closer to what we need for displaying within a Modal48pxadds too much padding for most existing cases24pxeven if it isn't quite what existing use cases are expecting, looks much less broken than removing the padding altogether.How?
24pxTesting Instructions
npm run storybook:devto test in Storybook, and try out each of the different configurations of DataViews.npm run devto run a dev build and test in the site editor, looking at things like Pages, Templates, and Patterns to see how the DataViews looks in these situations. Note a caveat below that the DataViews no longer lines up with the page admin header padding. I'm interested in feedback here and whether we should update that padding, too.Testing Instructions for Keyboard
Screenshots or screencast
Before
After
Questions
This is how it's looking in the site editor, where it's now further to the left / right than the header. If we go with this, should we also update the padding on the
.admin-ui-page__header?A caveat for the Modal case
When in a modal, there is still a tiny bit of padding around the outside, which you can see in the footer. Is this a deal breaker?