Skip to content
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

fix(@clayui/core): Vertical Bar open panel shouldn't disappear on resize #5434

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

pat270
Copy link
Member

@pat270 pat270 commented Mar 23, 2023

fixes #5433

@@ -60,7 +46,7 @@ export function Panel({children, keyValue, tabIndex}: Props) {
<CSSTransition
aria-labelledby={`${id}-tab-${keyValue}`}
className={classNames('sidebar', {
'c-slideout-show': activePanel === keyValue && isFirst,
Copy link
Member

Choose a reason for hiding this comment

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

@pat270 we have to ignore this in the first rendering, for example when opening the panel it is not doing animation anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Is the panel disappearing because the panelWidth is being changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

@matuzalemsteles Yes sort of, React ends up re-rendering which removes c-slideout-show.

@pat270 pat270 marked this pull request as draft March 24, 2023 21:22
@pat270 pat270 marked this pull request as ready for review March 27, 2023 21:11
@pat270
Copy link
Member Author

pat270 commented Mar 27, 2023

@matuzalemsteles I solved the disappearing panel and also fixed the transition between close and open panels. This seems a bit messy, but can't figure out a better way at the moment.

Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

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

fixed the transition between close and open panels

I'm not sure about this behavior, I think the old behavior was expected but it's also tricky because the design and implementation of VerticalBar is old and will change so we don't know what the ideal behavior would be yet.

Comment on lines 63 to 73
const isPanelOpen = (() => {
if (isFirst) {
return activePanel !== null;
} else if (previousActivePanelRef.current === activePanel) {
return true;
} else if (activePanel === null) {
return false;
} else {
return previousActivePanelRef.current !== null;
}
})();
Copy link
Member

Choose a reason for hiding this comment

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

I think this is better to be a function you call than to make an immediate function, this seems a little strange.

@pat270
Copy link
Member Author

pat270 commented Mar 28, 2023

@matuzalemsteles I remember there being a transition between panels somewhere but I can't seem to find it.

@emiliano-cicero @marcoscv-work how should the Vertical Bar transition between two panels?

  1. No sliding transition
    vertical-bar-no-transition

  2. With sliding transition
    vertical-bar-transition

@matuzalemsteles
Copy link
Member

@pat270 without the transition it shouldn't blink just render new content because the panel is already open. Just as it is in the master.

Kapture.2023-03-28.at.17.17.25.mp4

@pat270
Copy link
Member Author

pat270 commented Mar 29, 2023

@matuzalemsteles The panels should function how it did previously. We can revert to sliding panels in the future if it's needed.

Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

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

@pat270 seems to work great, could you just check the tests before going ahead with this?

@pat270
Copy link
Member Author

pat270 commented Mar 29, 2023

@matuzalemsteles Vertical Bar tests should be passing now

@matuzalemsteles matuzalemsteles merged commit c6cdf7c into liferay:master Mar 30, 2023
2 checks passed
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.

@clayui/core: Resizing an open panel in Vertical Bar makes the panel disappear
2 participants