Support Page Navigation Sidebar#465
Conversation
|
Discussion:
|
We can do that to allow for more flexibility. Maybe also allow a way for the author to specify a default for page navigation in
Might seem a bit too arbitrary. Since we are going to implement indentation, allowing the author to specify to such extent might make it difficult to render the indentation level reasonably. Also it is very likely that the author might forget to update the list when changing the heading texts.
I don't think that all pages will have page navigation activated, so I think it is fine for now to have a second pass, especially if it makes implementation way easier.
The design looks fine atm, I understand the rationale for putting the page nav scrollbar on the left side, but I hope the user isn't confused by it. :P Or maybe hide the scroll bar, while still allowing the user to scroll it with the mouse scroll wheel? |
Default value in
The difficult part about indentation comes from having the headings in the right order. I am referring that this current automatic page navigation doesn't allow the user to put some text above the heading links. It is simple to implement as there is already Getting the header string is the difficult part if we were to implement the I think we just need to choose between 2 different implementation choices for header string
👍
This was intentional as I felt having 2 scrollbars (page scroll) adjacent to each other was an eyesore. Hiding it would result in users perceiving that it is not scroll-able. A compromise is to lower the font size so more can fit within the A more extreme alternative would be having a dynamic font size such that all the headings fit without needing to scroll (but may render the headings unreadable if there are too many) |
|
This page has a well-done site-nave and page-nav if you need some inspiration :-) https://angular.io/guide/architecture-components |
Oh I see. Second variable seems OK? If the author does not specify, it can be the name of the page itself.
Hmm, looking at the Angular documentation for inspiration. :) The page nav scrollbar for the Angular documentation is on the right side, but it is of a different color compared to the actual page's scrollbar. It is also thinner than the default OS scrollbar. That style might be worth considering as well? |
|
Update:
|
yamgent
left a comment
There was a problem hiding this comment.
Nice. 👍 I like the indentation, they look quite nice.
Got some issues I noticed in the meantime though:
- When doing
markbind servelive preview, if the original document is modified, the page nav disappears when MarkBind rebuilds the page. - When selecting the items at the bottom of the page nav list (e.g.
Advanced Tips and Tricks), the page nav "jumps". This looks quite disorienting to the user.
| max-height: 80vh; | ||
| position: fixed; | ||
| width: 300px; | ||
| right: 0; |
There was a problem hiding this comment.
Remember to sort the attributes in alphabetical order.
This is due to having page navigation inserted only after a page has fully generated, and called only once within
Unfortunately Will look into improving this ... if it is possible. |
|
@Chng-Zhi-Xuan What's the planned behavior for preloaded but collapsed sections? For dynamically-loaded sections? |
@damithc , currently it is hard coded to not index content within any collapsed panels. It is easy to index it as the content is already there in the raw html file, however the I wanted to avoid having the users click on a What I may explore is maybe have the page navigation dynamically change depending on which headers are visible at any given point in time. However it is most likely difficult to code as well as having performance issues on deeply nested panels having its contents revealed in 1 click. |
What if the panel is expanded by default but collapsed by the user?
Sure, we can omit that from the first version. |
If the panel is expanded, its header + children content get indexed, including any child panels with headings. The logic is simplified to (If my parent component is a panel and it is not expanded, do not index). Upon collapsing by the user, the header link stays there but would not be able to jump to that header. The current planned behaviour is indexing any visible content upon loading the page, and not changing it if certain contents become visible / invisible. |
|
We could expand panels based on Related:
|
To clarify, you are suggesting that hidden headings within any panels will be expanded using a javascript function, upon clicking a Might be tricky given that panels can be deeply nested. Also need to test behaviour with Bootstrap's ScrollSpy. |
Correct. |
|
Update:
|
yamgent
left a comment
There was a problem hiding this comment.
Sorry for the late reply, I checked the latest one out, looks pretty good. 👍
Some comments on the code (I assume that it is more stabilized at this stage, but if the remaining features requires significant revamp, then the comments may not be appropriate now):
| // Increase nesting level by 1 | ||
| headingHTML += nestedHeadingHTML; | ||
| } else { | ||
| headingHTML += currentHeadingHTML; |
There was a problem hiding this comment.
There seems to be a mixture of determining how to partition the headings, and actual generation of the HTML code. Is it possible to separate the two? Otherwise the function gets really hard to read.
There was a problem hiding this comment.
The actual HTML generation needs to be concurrent with partitioning. It builds it from top to bottom while maintaining the stack.
I guess I can apply SLAP and bring the HTML generation to another function, similar to formatSiteNav?
There was a problem hiding this comment.
I guess I can apply SLAP and bring the HTML generation to another function, similar to
formatSiteNav?
I think that's a good place to start. We can see if there's any further improvements to be made after following that.
c43766e to
40d5916
Compare
|
Update:
Discussion: Regarding the issue of whether page navigation exists in a layout. Currently to activate the page navigation feature, the user needs to input a number or However, the layouts are file specific. So is there a good case to have a stand-alone file to have page navigation supported in layouts? Since the file will only have 2 lines (heading level and page navigation header text). |
Introduce a new file e.g., |
To extend your idea, currently the layout files for footer and other items are separated. It would be neater if all the different files (footer, siteNav, css) are all stored in their respective folders and have a simple E.G, content within Then all the different file types are just stored in their respective folders within |
That way the same files can be used in different layouts right? That would be highly desirable. |
|
Update:
Bug:
Discussion
|
|
Nice progress! For the bug, check if a heading with a font icon is affected. If it is, it's a significant problem because users can use font icons in headings often. Also, how about things like these? Use font color (rather than vertical bars) to indicate selected heading? As we already have two scroll bars on either side, using vertical bars to show current heading could become a case of 'too many vertical bars'? Alternatively, we can use dot or something. Should we move the scrollbar to be on the other side? It is true that having two scrollbars near to each other is a problem. Having one in the middle of the page doesn't look nice too, especially because the current one does attract a significant amount of attention. Alternativley, we can try to make it even thinner/lighter but not sure if that will affect the usability. Overall though, we can release the feature as soon as the functionality is correct and good enough. UI tweaks can be done in future releases. Again, good work! |
yamgent
left a comment
There was a problem hiding this comment.
Apologies for the late review, I think just two minor nits left, you can start squashing the commits already since it mostly seems fine now.
| -webkit-transition: 0.4s; | ||
| } | ||
|
|
||
| #page-nav a:link, #page-nav a:visited { |
There was a problem hiding this comment.
Put it in two lines, like so:
#page-nav a:link,
#page-nav a:visited {| $('modal').remove(); | ||
| $(elementSelector).each((i, elem) => { | ||
| // Check if heading or panel is already inside an unexpanded panel | ||
| let insideUnexpandedPanel = false; |
There was a problem hiding this comment.
insideUnexpandedPanel -> isInsideUnexpandedPanel (to make it clearer that the variable is a boolean).
930b577 to
896a95a
Compare
|
Update:
|
Upon further discussion, got future improvements possible. :P
896a95a to
80ae39e
Compare
|
Update:
Notes:
|
| <nav id="page-nav" class="navbar navbar-light bg-transparent slim-scroll"> | ||
| <a class="navbar-brand" style="white-space: inherit; color: black" href="#">Testing Page Navigation</a> | ||
| <nav class="nav nav-pills flex-column my-0 small" style="flex-wrap: nowrap;"> | ||
| <a class="nav-link py-1" href="#navigation">Navigation‎</a> |
There was a problem hiding this comment.
As discussed, this heading (a site nav) and the footer heading shouldn't be appearing. :P
80ae39e to
969dbf4
Compare
|
Update:
|
|
As spoken, have to rebase this PR now with the new anchor generated ID, we should have no problems with the pesky |
969dbf4 to
9a20ab5
Compare
|
Update:
|
That's great news! 💯 |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [x] Documentation update
• [x] New feature
Resolves #219
What is the rationale for this request?
User would like to be able to use a page navigation component that is automatically generated from headings within the page.
pageNavwithinfront-matterfromBooleanto{1 ... 6} or defaultpageNavHeadertofront-matteras the header text for page navigationsite-navorfooteris not specified in the pagePanel headersandPanel contentsif expandedmarkbind servere-inserts page navigationOn hold
Testing instructions: