-
Notifications
You must be signed in to change notification settings - Fork 373
feat(ExpandableSection): Allow more control over toggle icon #12051
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
base: main
Are you sure you want to change the base?
Conversation
|
Preview: https://pf-react-pr-12051.surge.sh A11y report: https://pf-react-pr-12051-a11y.surge.sh |
Allow for custom icons and disabled icons.
9849dc6 to
055efb6
Compare
| /** Whether to show a toggle icon when variant is not truncated. */ | ||
| hasToggleIcon?: boolean; |
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.
Not 100% about allowing the icon to totally be removed since it kinda removes the indication that you can click to expand/collapse something as well as its current state. If the toggle text updates based on the state + the text indicates somehow that it expands/collapses something, then less of an issue probably.
Maybe if we just have the prop description mention that if an icon is omitted, we recommend the toggle text to indicate the current state of the expandable section. Should we also get design sign off on this?
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.
We can add an error? My concern is that the consumer asked for a way for consumers to provide their own custom icon directly as part of the toggle 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.
I think allowing a custom icon would be fine - I assume whatever icon they pass in would retain the transition between expanded and collapsed at least. I'd be more wary about allowing the removal of the icon entirely is all.
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.
Got it - let me bug them and see if they can get by with the smaller 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.
If we do want to allow removing the icon, then we need to just make sure we tell consumers that it's up to them to ensure the current state of the ExpandableSection is conveyed, most likely by having dynamic toggle text. Idk if it's always going to be clear whether content that follows the toggle is part of the expandable section or not.
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.
+1 to updating the prop description to note the additional details a user would need to convey the expanded/collapsed state.
I'm also fine with keeping the custom icon and removing the toggle. The benefit of keeping the toggle would be if a user wanted to customize where in the toggle the icon would go (passing it as a child), but we could also have an icon alignment start/end prop instead.

Allow for custom icons and disabled icons.
What: Closes #12029
Additional issues: