-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
right nav toc
gives no visual indication its scrollable
#1746
Comments
toc
gives no visual indication is scrollabletoc
gives no visual indication its scrollable
Thanks for the detailed issue @techfg! I agree, we should improve this. I think to start with, the table of contents should have a scroll bar respecting user preferences in cases where it overflows. That’s important for accessibility. A scroll listener keeping it in sync could also be an option, but it would be a follow-up/complement to a proper scrollbar, because even if it keeps things in sync, users may want to use the scrollbar to explore the table of contents. |
Started experimenting a bit with this. This is not as easy as removing the One decision that would also need to be made is the position of this scrollbar. For example, after experimenting with a I guess another valid approach would be to have the scrollbar closer to the actual table of contents. For example, here the Docusaurus approach: Not sure if there are any recommendations on this, I'll have to research a bit more. |
@HiDeoo - Appreciate you looking in to this, funny, I was working on this last night and had some ideas/questions as well for final implementation 😄 Should have a POC to share some thoughts later today! |
I was able to finish the POC, details below. As @HiDeoo mentions, there are some open questions that would need to be answered prior to finalizing. Apologize in the advance for the lengthy post, lots to cover 😄 Disclaimer
POC DetailsThe POC is available at https://stackblitz.com/edit/withastro-starlight-5ct6eh. How to use
|
Thanks a lot for your very thorough experimentations and explanations. Definitely way better than my small experiment just adding a sidebar without modifying any behavior or exploring more options. Super appreciated! I'll try to give my thoughts about the different options and questions you raised, but of course, this is just my opinion and would love to hear more thoughts from others (and also more people experimenting with this).
I'll still continue to think about this and play more with the amazing playground you provided but if anyone else has any thoughts, please share them! |
HI @HiDeoo - Thanks for the taking the time to review the POC and providing your thoughts, appreciated! Great to have a reference for the supported browsers, thank you! You raise a very good point about the left sidebar scrollbar, agreed with you that if we end up with a scrollbar on the right sidebar, it should be identical in styling to the left. I do like how Docusaurus has their sidebar scrollbars styled Regarding adding a new config option, agreed, not needed - let's pick a single path and implement it, can always add config option in future if there's demand for it and that outweighs the increased maintenance cost. Based on your input and the above, I updated the POC to provide some additional options and control. Here's the new control panel:
The above changes provide a way to see how things would look if we treat the styling of the right & left sidebar the same, or different along with the different styles of scrollbars. One thing to note is that the webkit styled scrollbars have a hover color applied, forgot to mention that last night. My preference currently sits:
However, based on the feedback from @HiDeoo & @delucis thus far, I think where things are heading is the following:
The changes required for this are very small, only CSS and about 5 lines of it. Given that, and the guidance you provided on browser compatibility & testing, I'll work up an initial PR and we can iterate as needed. Of course, if anyone else has any input, feel free to share! |
Regarding above, after reviewing the code more, I found several places that have scrollbars beyond left & (soon to be) right nav (e.g., dropdowns) so going to shelve the For now, going with:
Look forward to any additional input, thanks! |
May I add my 2 cents to this discussion: I know that accessibility is very important and I really REALLY appreciate that you (@techfg) want to improve it even further. Thanks a lot for the whole effort you already put into this. However, I have to admit that too many sidebars look kinda ugly and I wouldn't like Starlight to go down that path... I think that adding another feature would be the golden middle path for accessibility and subtleness to Starlight:
I would really like to provide an example but unfortunately, this cool feature is not something that many companies have implemented (cause it's also rather hard to implement) and I can't currently think of any... If anyone understands what I mean and could provide an example website or StackBlitz I would be very grateful... |
@trueberryless - Thanks for the input and for resurfacing this issue! I do agree, I and I think others have as well in prior comments, that adding a scrollbar isn't ideal but from ascetics perspective :) That said, I think the direction from the Starlight team, at least for a first step, was to add it over some of the other options I had proposed with the idea that more could be done as things evolve. If I'm understanding your idea correctly, I think it's the 3rd option from my OP ("Add scroll listener to keep main-pane & starlight-toc always in sync"). Unfortunately, it looks like Vercel has actually changed their right side nav to no longer "sync" as the page scrolls so it no longer captures the idea represented in my 3rd option. In my post where I expanded on my POC, I made mention of nextra as an example of a site that keeps the nav scroll in-sync with the window scroll and they still do this (although it's very temperamental from what I can tell currently). Also, the POC I developed offers an example of this, see the Sync w/ Window Scroll instructions. Again, this is assuming I'm understanding what you are thinking :) All that said, I think underlying issue(s) here and going back to the title I put on this issue is that there is no current way for a user to even know the right nav is scrollable. I think this is a usability issue and then dovetails in to an accessibility issue because there needs to be an accessible way to scroll (once the user knows they can). Given that, I think possibly stepping back from the solution and instead shifting to defining what the goal of the right nav is in the first place, might make the decision clear(er). I do think that regardless of solution, it must be accessible, that is a given, so from a user story perspective on functionality, as a user, I need to be able to:
Curious what the SL team believes the goal(s) are for the right nav, in short, why is it even there? Assuming the goals are similar to what I've outlined above, my opinion is still the same as it was from the My $0.02 comment I made previously. While I'm not an accessibility expert, the reason I believe that a scrollbar is required (in addition to scrolling the nav to keep "context" with window scroll) is that it's one thing to give the user an indication that it can scroll and a way to allow scroll, but the method to scroll itself must be accessible and hence why the scrollbar is needed (a visual item) vs. mouse wheel or some other form of event handler. In this case, assuming a scrollbar is needed for accessibility reasons (not for any other), then having the scrollbar "thin" helps minimize the ascetics concerns we all believe exist with having it there. All that said, happy to take this whatever direction the SL team would like. Look forward to hearing yours and other thoughts, thanks! |
Thank you very much for providing an example. Nextra Docs is exactly what I meant and mean with the feature that needs to be added. As I said I agree very much with your opinion, but I would rather not see a scrollbar although you reasoned the accessibility very well. I just love good design, my bad, so I think they should at least add an option to disable the scrollbar if the add it in the first place imho... Let's see what the SL team brings to our future! |
Glad I was understanding what you were after correctly :) The POC I put together is able to demonstrate the Nextra concept. If you go to https://stackblitz.com/edit/withastro-starlight-5ct6eh and in the "Right Nav" section set "Style" to "scrollbar" and ""Sync w/ Window Scroll" to "yes". You can also set the "Scrollbar" section "Type" to "standard" and "Width" to "thin" to obtain the thin style scrollbar. I think it really comes down to what the goals of the right nav are to baseline and then from there, whether or not a "scrollbar" is required to meet accessibility guidelines. Ideally, SL config provides a toggle for all of the "options" although I'm not sure how much configuration bloat the SL team ideally would want to take on maintenance wise. Either way, look forward to hearing what the SL team thinks! |
My suggestion is to listen for changes in the aria-current attribute in the right sidebar and scroll the current heading to a fixed position at the top of the screen. This way, the TOC headings automatically follow the scroll, always staying within the visible area of the screen. I find this more convenient, especially for long documents where manually scrolling through the TOC can sometimes be a hassle. |
What version of
starlight
are you using?0.21.5
What version of
astro
are you using?4.6.0
What package manager are you using?
pnpm
What operating system are you using?
Linux
What browser are you using?
Chrome, Edge, FIrefox
Describe the Bug
In desktop mode, the
toc
appears on the right side of the screen. When the number of items in the list exceeds the viewport height, a couple of issues arise:Steps to reproduce:
toc
Expected Result:
toc
should give some visual indication that it separately scrollable; ORtoc
should scroll with the windowActual Result:
The
toc
does not move when scrolling, the bottom of thetoc
is not visible and there is no visual clue that it can be scrolled separately.Proposed Solutions:
main-pane
&starlight-toc
always in sync (e.g., https://vercel.com/docs/projects/overview)Link to Minimal Reproducible Example
https://starlight.astro.build/reference/overrides/
Participation
The text was updated successfully, but these errors were encountered: