-
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: Better handling of missing onClickItem prop #67402
Conversation
packages/dataviews/src/dataviews-layouts/utils/get-clickable-item-props.ts
Show resolved
Hide resolved
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. |
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.
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?
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Follow up to #67393
Raised #67393 (comment)
What?
When the user doesn't provide onClickItem, we shouldn't be adding button roles, onClickHandlers ...