-
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
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
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
also fixed in #65373
density={ density } | ||
setDensity={ setDensity } | ||
<Dropdown | ||
popoverProps={ { placement: 'bottom-end', offset: 9 } } |
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 could be extracted as a constant object, to avoid passing a new instance every re-render
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.
Also done in #65373
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:offset
for this for now.modal
behavior is something implemented only in DropdownMenuV2 right now. This should be handled properly I think when theDropdownV2
is implemented. --cc @ciampo @mirkaIt's not an impactful change and while it doesn't fix the
modal
behavior, I think it can be merged..Testing Instructions
In DataViews the view config dialog should be exactly as before, except: