DataViews: Use Dropdown for views config dialog#65314
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: +20 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
jameskoster
left a comment
There was a problem hiding this comment.
Good spot, that's much better.
79a5fac to
bedc60b
Compare
|
Hey @ntsekouras , catching up just now Overall the changes in this PR look good.
That seems to be a bit of a loop that happens when you click on the toggle button: popover loses focus, which triggers the I agree that this behaviour is weird, but I can't think of many ways to fix this without introducing potentially breaking changes. Using a
Sounds good. Also noting that, by default,
Modality of popover-based components is a tricky topic that we've been discussing for a while (#63674). A TL;DR is that we should be careful when using modal UI, since it's got big implications for users. What is certain is that, as we transition popover-based components to The current popover component is a bit of a mess: it implements some "modal"-like behaviour (like closing on blur), but not the full deal. With a new version of |
| padding: $grid-unit-20; | ||
| font-size: $default-font-size; | ||
| line-height: $default-line-height; | ||
| .components-popover__content { |
There was a problem hiding this comment.
Using internal component classnames can really hinder our ability to make changes to the components without causing unintended breaking changes.
In this case, we can use the DropdownContentWrapper component, which is used specifically to set custom padding for dropdown content. I will open a separate PR to make the change
There was a problem hiding this comment.
Thank you for your follow up! I wasn't aware of DropdownContentWrapper.
| setDensity={ setDensity } | ||
| <Dropdown | ||
| popoverProps={ { placement: 'bottom-end', offset: 9 } } | ||
| contentClassName="dataviews-view-config" |
There was a problem hiding this comment.
The dataviews-view-config classname is already used for the VStack in the DataviewsViewConfigContent, which causes some styles to be unexpectedly applied to two elements at the same time. We should probably remove this instance.
| density={ density } | ||
| setDensity={ setDensity } | ||
| <Dropdown | ||
| popoverProps={ { placement: 'bottom-end', offset: 9 } } |
There was a problem hiding this comment.
This could be extracted as a constant object, to avoid passing a new instance every re-render
What?
I observed in DataViews view config dialog that when you clicked the
trigger, the dialog would always reopen. After checking, Riad also mentions some inconsistencies and the not necessary usage of the lower level Popover component:offsetfor this for now.modalbehavior is something implemented only in DropdownMenuV2 right now. This should be handled properly I think when theDropdownV2is implemented. --cc @ciampo @mirkaIt's not an impactful change and while it doesn't fix the
modalbehavior, I think it can be merged..Testing Instructions
In DataViews the view config dialog should be exactly as before, except: