danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

Navigation auto-collapse feature #130

Open danielgtaylor opened 9 years ago

danielgtaylor commented 9 years ago

This issue is to discuss the new auto-collapse feature of the Olio theme engine. It is pulled from this discussion on another issue.

@danielgtaylor wrote:

It will now attempt to close as many groups as necessary to display everything on the page. That means some groups may stay open, and the groups it chooses are determined by their height. It will try to close the smallest possible group to fit everything on the screen. If nothing can be closed to fit everything, then the largest item is closed and it tries again, until either it runs out of items or fits everything.

If you make your window smaller and refresh the page, all items will get collapsed. If people have a very large screen, then they will see some of the items. The goal is to show as much as possible based on the window size at page load time.

@robbinjanssen wrote:

That explains :) we're getting a bit offtopic here (maybe a separate issue?) but for the toggling i'd suggest that:

  • Look at the currently selected item (#resource-group-action in the URL) and toggle that one open
  • If nothing is selected and the items don't fit, toggle the first item(s) open until they no longer fit

Anybody else have any thoughts?

danielgtaylor commented 9 years ago

The auto-collapse code lives here:

https://github.com/danielgtaylor/aglio/blob/olio-theme/templates/scripts.js#L97

robbinjanssen commented 9 years ago

In addition, maybe introduce the following configuration options:

danielgtaylor commented 9 years ago

@robbinjanssen thanks, I think it does make sense to allow people to disable the feature if they want, or collapse all. This will take a bit of development work and is additive, so I'm not going to let it block the 2.0 release.

OrangeDog commented 7 years ago

@robbinjanssen's ideas are all very sensible. The current behaviour is very annoying.