Skip to content
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: Better handling of missing onClickItem prop #67402

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

youknowriad
Copy link
Contributor

Follow up to #67393
Raised #67393 (comment)

What?

When the user doesn't provide onClickItem, we shouldn't be adding button roles, onClickHandlers ...

@youknowriad youknowriad added the [Type] Bug An existing feature does not function as intended label Nov 28, 2024
@youknowriad youknowriad self-assigned this Nov 28, 2024
Copy link

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jsnajdr <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Item clickability is now opt-out. isItemClickable is true by default unless you override it by your own callback. Also, it's effectively false if the onClickItem handler is not supplied.

The isItemClickable callback is only ever called only in getClickableItemProps, is that right? All other usages are just prop drilling.

I wonder if we could get rid of the prop drilling: why are we not reading the values from the DataViewsContext where they are already provided?

@youknowriad youknowriad enabled auto-merge (squash) December 2, 2024 11:38
@youknowriad youknowriad merged commit 39a4d1c into trunk Dec 2, 2024
61 of 62 checks passed
@youknowriad youknowriad deleted the improve/on-click-handler branch December 2, 2024 12:14
@github-actions github-actions bot added this to the Gutenberg 19.9 milestone Dec 2, 2024
im3dabasia pushed a commit to im3dabasia/gutenberg that referenced this pull request Dec 4, 2024
michalczaplinski pushed a commit that referenced this pull request Dec 5, 2024
@ramonjd ramonjd added [Package] DataViews /packages/dataviews [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants