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

[DashboardLayout] Fix sidebar CSS transitions for some breakpoints #4522

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

gil-obradors
Copy link

@gil-obradors gil-obradors commented Dec 8, 2024

Closes #4505

Disable the CSS transitions only for the temporary sidebar that shows on mobile devices, but also not needed when CollapsibleSidebar is disabled.

  • I've read and followed the contributing guide on how to create great pull requests.
  • I've updated the relevant documentation for any new or updated feature.
  • I've linked relevant GitHub issue with "Closes #".
  • I've added a visual demonstration in the form of a screenshot or video.
Enregistrament.de.pantalla.2024-12-08.213424.mp4

disable the CSS transitions only for the temporary sidebar that shows on mobile devices, but also not needed when CollapsibleSidebar is disabled.

Signed-off-by: Gil Obradors <[email protected]>
@@ -240,8 +240,7 @@ function DashboardLayout(props: DashboardLayoutProps) {
[toggleNavigationExpanded],
);

const hasDrawerTransitions =
isOverSmViewport && (disableCollapsibleSidebar || !isUnderMdViewport);
const hasDrawerTransitions = isOverSmViewport && !disableCollapsibleSidebar;
Copy link
Member

@apedroferreira apedroferreira Dec 11, 2024

Choose a reason for hiding this comment

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

Suggested change
const hasDrawerTransitions = isOverSmViewport && !disableCollapsibleSidebar;
const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);

Thanks a lot for your PR!

Looks like this suggestion would be the correct logic instead, as when disableCollapsibleSidebar is true, the non-persistent drawer menu shows up to the md breakpoint as opposed to just sm.

This would require replacing the isUnderMdViewport variable with isOverMdViewport and inverting all logic where isUnderMdViewport is currently being used (it's only in a couple of places).

Copy link
Member

@apedroferreira apedroferreira Dec 11, 2024

Choose a reason for hiding this comment

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

My first suggestion was incorrect, the new one should be good!
Sorry if it caused any confusion.

@apedroferreira apedroferreira self-assigned this Dec 11, 2024
@apedroferreira apedroferreira added component: layout This is the name of the generic UI component, not the React module! scope: toolpad-core Abbreviated to "core" bug 🐛 Something doesn't work labels Dec 11, 2024
@Janpot
Copy link
Member

Janpot commented Dec 11, 2024

How hard would it be to add coverage for this in a test? Ideally we aim for adding tests when we fix bugs and especially regressions.

@apedroferreira
Copy link
Member

apedroferreira commented Dec 11, 2024

How hard would it be to add coverage for this in a test? Ideally we aim for adding tests when we fix bugs and especially regressions.

Probably quite difficult here as it's related to CSS transitions, which could also mean it's not a major issue that needs to be covered by tests...
Unless some kind of visual snapshots can be taken during the transition, maybe we could try that.

@Janpot
Copy link
Member

Janpot commented Dec 11, 2024

Unless some kind of visual snapshots can be taken during the transition, maybe we could try that.

No, don't worry in that case. Let's not waste time on it right now.

@apedroferreira apedroferreira changed the title fix: hasDrawerTransition's logics [DashboardLayout] Fix sidebar CSS transitions for some breakpoints Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: layout This is the name of the generic UI component, not the React module! scope: toolpad-core Abbreviated to "core"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DashboardLayout] No CSS transitions in persistent sidebar under certain screen width
3 participants