You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DataViewsPicker: Improve appearance when used in a Modal component #72336
Modals have an inner div that wraps content, and this doesn't work well with the sticky footer, I think because it has its own overflow and doesn't take up the full height of the modal.
DataViewsPicker has extra padding when used in a Modal
All of the main components that make up DataViews/DataViewsPicker have extra padding around them, when placing in the Modal which also has its own padding around content, it results in a lot of empty space.
In the following screenshot you can see it causes the modal's header to be misaligned with the content:
It should perhaps instead look more like this (padding removed from DataViewsPicker's components):
In a vacuum I think this makes the most sense. Then DataViews just inherits padding from its container, nice and easy.
However, I think that would make it impossible (without some hacks) to achieve the current table/list layout designs where the row background and stroke is 'full width'. In other words, I don't think this is ideal:
Compared to trunk:
cc @WordPress/gutenberg-design for thoughts on that though. Maybe it's not a huge deal and can be tweaked a bit to work?
Another option would be to allow container components to customise padding, ideally in a way that references semantic spacing tokens. So in the above case we'd do something like:
Can be solved visually in a few ways, including removing the hover effect entirely (😱), or by letting that hover effect extend the padding-width beyond its container left and right (a la Google Docs, and would require visible overflow).
I think I'd optimize for reusability. If we need the edge to edge effect, which I think is primarily for table and list layouts, then probably the entire modal with its padding rules should be part of the picker. Otherwise I'd go for cleaner separation of concerns. If that makes sense.
…including removing the hover effect entirely (😱), or by letting that hover effect extend the padding-width beyond its container left and right (a la Google Docs, and would require visible overflow).
-1 😅 I see this impacting the component negatively. Unless I'm understanding the implementation wrongly.
I second the effort of reaching the current layout designs. So if we can reach the spacing approach shown in the screenshot attached in the initial comment and include the other layouts in follow-up tickets, that would be great.
Maybe the hover effect could be achieved using an absolutely positioned pseudo element? That way the cell contents remain aligned, but the hover style doesn't need to span the full width, and DataViews can inherit padding from its parent container. Something like this:
I'd welcome @oandregal's thoughts on the idea of removing layout padding at the DataViews layer. If we can find a design that works (which seems possible based on the discussion above) I think this would be a nice enhancement.
👍 It seems easier to handle it at the container level, and I can't think of a reason that'd be an issue. It'd also allow us to remove these styles for card.
Here's a quick mockup to demonstrate how DataViews Table and List would appear in containers with different padding values. All horizontal padding on DataViews is removed. The selected state would be a separate element that is 100% + 32px wide, and offset by 16px.
In a vacuum I think this makes the most sense. Then DataViews just inherits padding from its container, nice and easy.
I'm a fan of the "parents decide padding" approach to styling. Ideally it would be a wholistic DS-wide strategy. I think props like __nextHasNoMarginBottom (basically saying the parent is responsible for the spacing) suggest that perhaps we're already moving in that direction?
The wrinkle with that approach for dataviews is that we'd like the row borders to extend out to the edge of the card, which requires the dataview (not the container) to be the one applying the actual CSS.
allow container components to customise padding
This kinda feels unorthodox initially, but I think once you decide on the "parents decide padding" strategy, then this actually feels natural: the nature of these row borders means the padding CSS needs to be inside the dataview, but we've decided parents should decide the padding, therefore it is a prop.
it'd be good to add a story demonstrating the picker in a modal
I've opened a small PR to add a storybook story, hopefully it'll help a little with debugging / testing some of the issues raised here (and potential solutions): #72913
Alrighty, I've given the 24px padding standardisation idea a shot, and have put up a PR over in #73334 — I think something in this direction is likely a decent pragmatic bet for now as it simplifies the existing CSS without creating a new API, and results in less breakage for existing usages than removing the padding entirely.
I've added most folks here as reviewers in case we can go with that direction, but as always, happy to close out the PR if there are better ideas for what to try next.
Alrighty, I've closed out a few of my experiments as the discussion appears to have consolidated toward the idea of customisable padding on the DataViews or DataViewsPicker component, using a controlled vocabulary of token names (for consistency with the Card component).
As always, very happy for feedback and ideas. The PR I'm working from is #72989 and it should be ready for review now.
I'll be working on some other things next week, so I may be a little slow in implementing review feedback, but I'm keen to help solve this problem. Thanks again for all the collaboration here, everyone!
The conversation on the PR and here seems on track with some generally good instincts.
I suspect based on the conversation that this is already being thought of, but combining negative margins with paddings seems to be a sticking point that could potentially allow edge-to-edge-borders while the other content still aligning with modal titles, is that right? And does that account for cases where perhaps the modal padding change between breakpoints, i.e. does negative margins account for that somehow?
Update: I'd love to hear from folks as to how everyone's feeling about the different proposed options. While there's been some positive feedback on the idea of customising via a padding prop, there's also a concern raised about the added complexity. This leans me back toward considering standardising on 24px for padding for DataViews as it simplifies the CSS a bit without adding an additional API.
Keen to hear everyone's thoughts before I go further on the customisable padding PR. I'd prefer (if we can) to avoid adding extra complexity or APIs if we don't need to. These are the main PRs I'm proposing:
Update: I'd love to hear from folks as to how everyone's feeling about the different proposed options. While there's been some positive feedback on the idea of customising via a padding prop, there's also a concern raised about the added complexity. This leans me back toward considering standardising on 24px for padding for DataViews as it simplifies the CSS a bit without adding an additional API.
I don't want to unnecessarily nudge us back into philosophical talks, but are we simply trying to solve DataView layout issues in modals? We've covered a lot of ground in these chats, hoping to solve the general rigidness with DataView spacing. Normalizing to 24px itself does have ecosystem impacts. So while the code changes are minimal, the changes are noticeable, mostly everywhere.
Using 48px for padding is very opinionated, 24px less so. That seems like a change we should make provided it still aligns within the overall spacing system used in wordpress/components.
I don't want the overall padding conversation to end. On that front, I'm not certain if we're lacking data, or hoping time will force us into a decision. I admittedly have skin in the game, hoping for controls so I can provide a better mobile experience to my users.
One global aspect I'd like to consider is how do we enable consumers to style DataViews. No matter if it's padding like in this issue or background-color, like this other one. It wouldn't be a great experience if consumers use CSS Custom Properties for background, but a component property for padding.
Over at #73390 Jay was looking at leveraging CSS Custom Properties for consumers to be able to change the background color. Given that's already what we do in existing components, and how we expect the Design System to work, that approach has familiarity. I haven't caught up on all the conversations here and in the PRs (will do over the following days), but I wonder if we can consolidate everything around that.
It wouldn't be a great experience if consumers use CSS Custom Properties for background, but a component property for padding.
Indeed. Thanks for taking a look here, I'd love to see how we can simplify (and/or) consolidate where possible, rather than adding too much complexity. I feel like we kind of need: a) a better and simpler padding default so that folks don't need to adjust padding very often, and b) provide a simple method to adjust that padding when needed.
The more that I think about the customisable padding PR in 72989, I feel like it's probably overkill — we likely don't want folks to change the padding all that often. So perhaps something like #73334 (standardise on 24px), plus using CSS variables to allow overrides (potentially in a follow-up PR) might make for a simpler path forward 🤔
So perhaps something like #73334 (standardise on 24px), plus using CSS variables to allow overrides (potentially in a follow-up PR) might make for a simpler path forward 🤔
This seems like a sound proposal to unblock the impasse: provide a baseline value and allow overrides via CSS vars.
Lot's of discussion in many places 😄 . I'd echo @oandregal to have a single way of adjusting styles and it seems the CSS vars is a good approach for this. We might need more style adjustments in the future and adding specific props wouldn't scale well.
Said that, I believe standardise on 24px and using CSS vars could be in separate PRs. Ideally the default padding for these components should be zero and not opinionated at all, so I'm not sure how valuable a change like this (reducing to 24px) at this point, since all WP usages right now are based on the current padding (see page header paddings etc..). No strong opinions though for that.
Ideally the default padding for these components should be zero and not opinionated at all
We covered some of this ground in #73127 that tried removing padding altogether. It causes issues with the scrollbar (too close to content) and buttons on the outer edge of the DataViews where the focus styles get cut off. So there'd be more to figure out if we go down that path.
Standardising on some padding seems the lowest barrier to clear to me, and it allows us to remove some of the container queries as 24px is already a default in narrower containers. So I'm still leaning toward #73334 as a first step. Let me know if folks think that's an okay path to pursue, and I can tidy it up.
Activity
jameskoster commentedon Oct 23, 2025
In a vacuum I think this makes the most sense. Then DataViews just inherits padding from its container, nice and easy.
However, I think that would make it impossible (without some hacks) to achieve the current table/list layout designs where the row background and stroke is 'full width'. In other words, I don't think this is ideal:
Compared to trunk:
cc @WordPress/gutenberg-design for thoughts on that though. Maybe it's not a huge deal and can be tweaked a bit to work?
Another option would be to allow container components to customise padding, ideally in a way that references semantic spacing tokens. So in the above case we'd do something like:
And for the media picker something like:
And for DataViews in Cards:
But obviously this would be a larger undertaking 😅 It also unclear if this level of customisation is something we'd definitely want to offer.
I'd welcome the thoughts of @oandregal @mirka @aduth on this issue.
jasmussen commentedon Oct 23, 2025
Can be solved visually in a few ways, including removing the hover effect entirely (😱), or by letting that hover effect extend the padding-width beyond its container left and right (a la Google Docs, and would require visible overflow).
I think I'd optimize for reusability. If we need the edge to edge effect, which I think is primarily for table and list layouts, then probably the entire modal with its padding rules should be part of the picker. Otherwise I'd go for cleaner separation of concerns. If that makes sense.
fcoveram commentedon Oct 23, 2025
-1 😅 I see this impacting the component negatively. Unless I'm understanding the implementation wrongly.
I second the effort of reaching the current layout designs. So if we can reach the spacing approach shown in the screenshot attached in the initial comment and include the other layouts in follow-up tickets, that would be great.
jameskoster commentedon Oct 23, 2025
Maybe the hover effect could be achieved using an absolutely positioned pseudo element? That way the cell contents remain aligned, but the hover style doesn't need to span the full width, and DataViews can inherit padding from its parent container. Something like this:
jasmussen commentedon Oct 23, 2025
Perhaps a wee bit rounded, but yes that is what I imagined with my comment around negative offset paddings.
jameskoster commentedon Oct 23, 2025
This could simplify the responsive styling of DataViews too, passing the responsibility on to the Page component (arguably where it belongs).
jameskoster commentedon Oct 27, 2025
I'd welcome @oandregal's thoughts on the idea of removing layout padding at the DataViews layer. If we can find a design that works (which seems possible based on the discussion above) I think this would be a nice enhancement.
oandregal commentedon Oct 29, 2025
👍 It seems easier to handle it at the container level, and I can't think of a reason that'd be an issue. It'd also allow us to remove these styles for card.
jameskoster commentedon Oct 29, 2025
Here's a quick mockup to demonstrate how DataViews Table and List would appear in containers with different padding values. All horizontal padding on DataViews is removed. The selected state would be a separate element that is 100% + 32px wide, and offset by 16px.
p-jackson commentedon Oct 30, 2025
I'm a fan of the "parents decide padding" approach to styling. Ideally it would be a wholistic DS-wide strategy. I think props like
__nextHasNoMarginBottom(basically saying the parent is responsible for the spacing) suggest that perhaps we're already moving in that direction?The wrinkle with that approach for dataviews is that we'd like the row borders to extend out to the edge of the card, which requires the dataview (not the container) to be the one applying the actual CSS.
This kinda feels unorthodox initially, but I think once you decide on the "parents decide padding" strategy, then this actually feels natural: the nature of these row borders means the padding CSS needs to be inside the dataview, but we've decided parents should decide the padding, therefore it is a prop.
andrewserong commentedon Nov 3, 2025
I've opened a small PR to add a storybook story, hopefully it'll help a little with debugging / testing some of the issues raised here (and potential solutions): #72913
33 remaining items
andrewserong commentedon Nov 17, 2025
Alrighty, I've given the
24pxpadding standardisation idea a shot, and have put up a PR over in #73334 — I think something in this direction is likely a decent pragmatic bet for now as it simplifies the existing CSS without creating a new API, and results in less breakage for existing usages than removing the padding entirely.I've added most folks here as reviewers in case we can go with that direction, but as always, happy to close out the PR if there are better ideas for what to try next.
jameskoster commentedon Nov 17, 2025
I think it's okay:
I don't know if we need to optimise beyond that, 24px seems like a good default for Cards in general.
andrewserong commentedon Nov 21, 2025
Alrighty, I've closed out a few of my experiments as the discussion appears to have consolidated toward the idea of customisable padding on the DataViews or DataViewsPicker component, using a controlled vocabulary of token names (for consistency with the Card component).
As always, very happy for feedback and ideas. The PR I'm working from is #72989 and it should be ready for review now.
I'll be working on some other things next week, so I may be a little slow in implementing review feedback, but I'm keen to help solve this problem. Thanks again for all the collaboration here, everyone!
jasmussen commentedon Nov 21, 2025
The conversation on the PR and here seems on track with some generally good instincts.
I suspect based on the conversation that this is already being thought of, but combining negative margins with paddings seems to be a sticking point that could potentially allow edge-to-edge-borders while the other content still aligning with modal titles, is that right? And does that account for cases where perhaps the modal padding change between breakpoints, i.e. does negative margins account for that somehow?
andrewserong commentedon Nov 23, 2025
Update: I'd love to hear from folks as to how everyone's feeling about the different proposed options. While there's been some positive feedback on the idea of customising via a
paddingprop, there's also a concern raised about the added complexity. This leans me back toward considering standardising on24pxfor padding for DataViews as it simplifies the CSS a bit without adding an additional API.Keen to hear everyone's thoughts before I go further on the customisable padding PR. I'd prefer (if we can) to avoid adding extra complexity or APIs if we don't need to. These are the main PRs I'm proposing:
24pxand on balance, reduce the CSS included in DataViews) — this is the one I'm leaning towardsStevenDufresne commentedon Nov 23, 2025
I don't want to unnecessarily nudge us back into philosophical talks, but are we simply trying to solve DataView layout issues in modals? We've covered a lot of ground in these chats, hoping to solve the general rigidness with DataView spacing. Normalizing to
24pxitself does have ecosystem impacts. So while the code changes are minimal, the changes are noticeable, mostly everywhere.Using
48pxfor padding is very opinionated,24pxless so. That seems like a change we should make provided it still aligns within the overall spacing system used inwordpress/components.I don't want the overall padding conversation to end. On that front, I'm not certain if we're lacking data, or hoping time will force us into a decision. I admittedly have skin in the game, hoping for controls so I can provide a better mobile experience to my users.
oandregal commentedon Nov 24, 2025
One global aspect I'd like to consider is how do we enable consumers to style DataViews. No matter if it's padding like in this issue or background-color, like this other one. It wouldn't be a great experience if consumers use CSS Custom Properties for background, but a component property for padding.
Over at #73390 Jay was looking at leveraging CSS Custom Properties for consumers to be able to change the background color. Given that's already what we do in existing components, and how we expect the Design System to work, that approach has familiarity. I haven't caught up on all the conversations here and in the PRs (will do over the following days), but I wonder if we can consolidate everything around that.
andrewserong commentedon Nov 24, 2025
Indeed. Thanks for taking a look here, I'd love to see how we can simplify (and/or) consolidate where possible, rather than adding too much complexity. I feel like we kind of need: a) a better and simpler padding default so that folks don't need to adjust padding very often, and b) provide a simple method to adjust that padding when needed.
The more that I think about the customisable padding PR in 72989, I feel like it's probably overkill — we likely don't want folks to change the padding all that often. So perhaps something like #73334 (standardise on
24px), plus using CSS variables to allow overrides (potentially in a follow-up PR) might make for a simpler path forward 🤔ramonjd commentedon Nov 25, 2025
This seems like a sound proposal to unblock the impasse: provide a baseline value and allow overrides via CSS vars.
ntsekouras commentedon Nov 25, 2025
Lot's of discussion in many places 😄 . I'd echo @oandregal to have a single way of adjusting styles and it seems the CSS vars is a good approach for this. We might need more style adjustments in the future and adding specific props wouldn't scale well.
Said that, I believe
standardise on 24pxand using CSS vars could be in separate PRs. Ideally the default padding for these components should be zero and not opinionated at all, so I'm not sure how valuable a change like this (reducing to 24px) at this point, since all WP usages right now are based on the current padding (see page header paddings etc..). No strong opinions though for that.andrewserong commentedon Nov 25, 2025
We covered some of this ground in #73127 that tried removing padding altogether. It causes issues with the scrollbar (too close to content) and buttons on the outer edge of the DataViews where the focus styles get cut off. So there'd be more to figure out if we go down that path.
Standardising on some padding seems the lowest barrier to clear to me, and it allows us to remove some of the container queries as
24pxis already a default in narrower containers. So I'm still leaning toward #73334 as a first step. Let me know if folks think that's an okay path to pursue, and I can tidy it up.