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

Collapse navbar unless window is really wide #2716

Merged
merged 2 commits into from
Nov 16, 2020

Conversation

henrikt-ma
Copy link
Collaborator

This PR addresses the problem that when HTML documentation is viewed on a small screen, too much horizontal space is occupied by the navbar on the left side. The solution is to collapse the navbar unless the window is really wide, expanding it when hovered. Readers who prefer to have the navbar open all the time to see the overview of the current chapter just have to make the window sufficiently wide.

Alternative approaches that were considered include:

  • Reducing the fixed width to much less than the current 350px is not good because truncated section titles don't look good, meaning we don't wan't even more of them.
  • Allowing line wrap is also a bad alternative since section titles occupying several lines can easily make the table of contents expand in vertical direction so much that it's hard to get an overview.
  • An open/close button for changing the state of the navbar. This would be meaningful if there was really some state of the navbar that was worth preserving when jumping between chapters, as this seems to require cookies to avoid a state that gets reset every time one jumps to a different page (chapter). We don't seem to have enough state of interest to motivate introduction of cookies.

@henrikt-ma
Copy link
Collaborator Author

In really narrow windows (small screens), I'd actually prefer a navbar that occupies no horizontal space at all when collapsed, allowing the main content to begin at the left edge of the window. I think it would remain to be seen whether accessing the navbar from a small icon in the top left corner would be convenient enough to also replace the proposed solution on medium sized windows.

@henrikt-ma
Copy link
Collaborator Author

I haven't tried this on a device with touch screen. While it might seem as it wouldn't work, I note that examples of hover-expanded menus seem to work well on my phone. Therefore, unless someone knows that relying on hovering is a really bad idea, I suggest that we merge this so that we can test it ourselves on various devices before abandoning CSS hover effects in favor of javascript.

@HansOlsson
Copy link
Collaborator

Hmm...
I tried to check it and downloading the generated files didn't show any collapsing navbar regardless of window width (on iPhone it was just on top). It could be a problem with using css-files from local file-system (I have noticed this before).

But at least it doesn't seem to cause problem, so I will just check it a bit more and then accept and merge.

@henrikt-ma
Copy link
Collaborator Author

OK. If it doesn't work to satisfaction after the merge we shouldn't hesitate to revert the merge.

It also makes sense to not explore a solution for really narrow screens before we've had a chance to see the current design in an actual build.

Copy link
Collaborator

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

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

Ok, seems ok and doesn't seem to break everything.
Let's try it.

@HansOlsson HansOlsson merged commit bcd8f49 into modelica:master Nov 16, 2020
@henrikt-ma henrikt-ma deleted the styling/html-collapse-navbar branch November 17, 2020 10:17
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.

None yet

2 participants