-
Notifications
You must be signed in to change notification settings - Fork 375
fix(Drawer): expand only onTransitionEnd of the drawer #8801
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
Conversation
|
Preview: https://patternfly-react-pr-8801.surge.sh A11y report: https://patternfly-react-pr-8801-a11y.surge.sh |
thatblindgeye
left a comment
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 looks great! Just had a comment below that I'd appreciate your feedback on
| onTransitionEnd={(ev) => { | ||
| if (!hidden && ev.nativeEvent.propertyName === 'transform') { | ||
| onExpand(); | ||
| if ((ev.target as HTMLElement).id === (id || panelId)) { |
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.
An alternative to this:
| if ((ev.target as HTMLElement).id === (id || panelId)) { | |
| if ((ev.target as HTMLElement) === panel.current) { |
Not really sure how common an issue it'd be, but one thing I noticed when checking if the target id === the component id/panelId is that if we have something like the following:
<DrawerPanelContent id="tester">
Then if within the drawer if some element like an expandable toggle would be the target and have that same ID, it causes the original bug to resurface. In the clip below I just added id="tester" to .pf-c-expandable-section__toggle-icon via dev tools since I don't believe we could pass an ID to that exact element otherwise, but I'm more imagining a scenario where some custom expandable toggle is used instead.
Drawer.Panel.matching.ID.mov
Checking whether the target === the panel.current with the same setup as the above clip:
Drawer.Panel.matching.ref.mov
Personally I might lean more towards checking the target against the panel ref since ID duplication can happen, but like I said I'm not sure how common this would actually be. What do you think, @MariaAga ?
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 I think its better to be safer, changed it
thatblindgeye
left a comment
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 like there's just a snapshot that needs to be updated. @wise-king-sullyman was that issue with Timestamp tests resolved or is it still finicky?
|
rebased and now tests are green |
@thatblindgeye I disabled the timestamp test that was problematic. |
|
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #8510
can be tested by replacing
packages/react-core/src/components/Drawer/examples/DrawerStackedContentBodyElements.tsxwith: https://codesandbox.io/s/drawerstackedcontentbodyelements-t8v58c?file=/index.tsxand seeing that
onExpandcounter is not growing whenShow moreis clicked