-
Notifications
You must be signed in to change notification settings - Fork 360
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
TreeView: Replace button wrapper around actions with a div #4967
TreeView: Replace button wrapper around actions with a div #4967
Conversation
PF4 preview: https://patternfly-react-pr-4967.surge.sh |
@christiemolloy can you verify the structure for the action element? Looks like the action element is in Looking at select/app-launcher favorites (https://www.patternfly.org/v4/components/application-launcher#with-favorites-and-search), the main item and associated action are siblings. So focus goes from one to the other without one being nested in the other. It seems like the tree view component is setup to do that - then we could get rid of the |
packages/react-core/src/components/TreeView/__tests__/TreeView.test.tsx
Outdated
Show resolved
Hide resolved
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.
Code LGTM!
@mcoker I resolved comments re: variant and aria-label and rebased. |
@redallen can you re-approve? |
40b45fd
to
0013995
Compare
action?: React.ReactNode; | ||
/** Additional properties of the tree view item action button */ | ||
actionProps?: any; |
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.
I know TreeView is relatively new, but isn't this a breaking 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.
Yeah it is. It's a beta component though, I thought breaking changes were ok / covered by the disclaimer?
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.
@redallen should I make a note/label somewhere indicating the breaking changes, or will that screw up semantic release versioning since it's beta?
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.
Just make note of it in the OP of this PR for the release notes.
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.
Ok, didn't realize this was still beta
@mcoker Yeah that makes sense. Originally it was inside because the design specified that you would hover over the node and the action item would appear. |
@christiemolloy great, thanks! I'll submit a core PR to fix the layout in this PR. Issue - patternfly/patternfly#3592 |
@mturley patternfly/patternfly#3593 in core has been merged and is in 4.51.2, which should fix the action alignment in this PR. |
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.
LGTM
Your changes have been released in:
Thanks for your contribution! 🎉 |
Resolves #4799.
Relevant core change: patternfly/patternfly#3522
Allows any arbitrary JSX to be used in the
action
prop on a TreeViewListItem, wrapping it in a plain div with.pf-c-tree-view__action
instead of a button. Replaces the existing examples which pass bare icons to this prop with buttons containing those icons.This makes it possible to render a
<Dropdown>
in the action container of a tree view item without resulting in a button-in-a-button.BREAKING CHANGES: existing consumers who want to keep the previous behavior must wrap the contents of their
action
in a<Button>
and pass the values of theiractionProps
directly to the button.