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

Sidebar auto-collapses any collapsable children on wide media - fix included #5590

Closed
GodzillaDaThrilla opened this issue Sep 7, 2018 · 3 comments
Labels
affected-very-few This issue impacts very few customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-templates severity-minor This label is used by an internal tool
Milestone

Comments

@GodzillaDaThrilla
Copy link

Figured this out while trying to create an accordion on the sidebar. I found that the standard bootstrap collapse on child elements worked fine on small screens where the sidebar collapses to the top, but on large screens the accordion menu(s) would just keep re-collapsing (again, only only large screens, collapseable elements functioned normally in mobile view).

The Problem:

The problem is with the default template, specifically this in NavMenu.cshtml:
image
and this in site.css:
image

This means that the collapse prevention is inherited by all child elements on wide screens, which makes a hamburger/accordion-style menu impossible.

The Fix:

Add an arbitrary class to the HTML - I called mine navInner:
image
Then modify the CSS so it targets only the sidebar specifically and not its children. I did this by replacing the ".collapse" with a combo-selector ".navInner.collapse" :
image

The Result:

image
image
Hey hey, it works!

@aspnet-hello aspnet-hello transferred this issue from dotnet/blazor Dec 17, 2018
@aspnet-hello aspnet-hello added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-blazor Includes: Blazor, Razor Components labels Dec 17, 2018
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @GodzillaDaThrilla.
Nice fine. Feel free to send us a PR and we'll happily consider it!

@mkArtakMSFT mkArtakMSFT added 1 - Ready help wanted Up for grabs. We would accept a PR to help resolve this issue labels Apr 19, 2019
@javiercn
Copy link
Member

@GodzillaDaThrilla Thanks for reaching out. What you are describing seems to be indeed a problem. Could this be fixed with just a more specific css selector? like .sidebar>.collapse?

I'm not sure why we would change our current behavior, as templates are a starting point and can be modified/updated by users. If there is a straight forward fix (like using a more specific selector) we would gladly take it I think, but otherwise, you can always modify the document to suit your needs.

@danroth27 danroth27 modified the milestones: 3.0.0-preview7, Backlog Apr 25, 2019
@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label Jan 10, 2020
@captainsafia captainsafia removed the help wanted Up for grabs. We would accept a PR to help resolve this issue label Sep 9, 2020
@SteveSandersonMS SteveSandersonMS added affected-very-few This issue impacts very few customers severity-minor This label is used by an internal tool labels Oct 14, 2020 — with ASP.NET Core Issue Ranking
@mkArtakMSFT
Copy link
Member

Closing as we've never received a response here nor there was general community interest here.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-very-few This issue impacts very few customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-templates severity-minor This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

8 participants