Skip to content

Conversation

@MariaAga
Copy link
Contributor

What: Closes #8510

can be tested by replacing packages/react-core/src/components/Drawer/examples/DrawerStackedContentBodyElements.tsx with: https://codesandbox.io/s/drawerstackedcontentbodyelements-t8v58c?file=/index.tsx
and seeing that onExpand counter is not growing when Show more is clicked

@patternfly-build
Copy link
Contributor

patternfly-build commented Mar 10, 2023

@tlabaj tlabaj requested a review from thatblindgeye March 17, 2023 14:16
Copy link
Contributor

@thatblindgeye thatblindgeye left a 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)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative to this:

Suggested change
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 ?

Copy link
Contributor Author

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

Copy link
Contributor

@thatblindgeye thatblindgeye left a 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?

@MariaAga
Copy link
Contributor Author

rebased and now tests are green

@tlabaj
Copy link
Contributor

tlabaj commented Mar 17, 2023

🎉 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?

@thatblindgeye I disabled the timestamp test that was problematic.

@tlabaj tlabaj merged commit ea884b5 into patternfly:v5 Mar 20, 2023
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@5.0.0-alpha.41
  • @patternfly/react-core@5.0.0-alpha.41
  • @patternfly/react-docs@6.0.0-alpha.44
  • demo-app-ts@5.0.0-alpha.24
  • @patternfly/react-table@5.0.0-alpha.41

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Drawer - expandable section inside the panel content causes drawer's onExpand to be fired

4 participants