suborbital / docs

Documentation monorepo for Suborbital projects and products
https://docs.suborbital.dev
Apache License 2.0
8 stars 5 forks source link

Show default language tabs when language selection is not available #73

Closed flaki closed 2 years ago

flaki commented 2 years ago

This is a followup from #57 - when a tabbed language component does not list the currently selected language tab the tab component will appear empty. This is confusing behavior and we should fix it (whether by falling back to a default tab or showing a 'fake' tab noting that the currently selected language is not available for the code block depends on further UX-considerations).

flaki commented 2 years ago

I did some spelunking and realized that Docusaurus saves the selected value in localStorage under the key docusaurus.tab.reactr-language (in this case), which explains why I was having problems reproducing this earlier.

flaki commented 2 years ago

I just pushed a fix for this in #105

At this week's docs meeting there was discussion about displaying all tabs even when they are not present. Technically this is perfectly feasible (in fact, we explicitly filter out the languages not used as we display the component). I believe from a UX perspective showing 6 languages that do not have any content is not ideal (particularly on smaller screen sizes, think phones and tablets), but I can be convinced, @LauraLangdon @ramonh feel free to open another issue for that.

Another thing mentioned was having a "phantom" tab show up whenever the currently chosen language has no tabs present, I actually kinda like this idea, and it feels like a good tradeoff in terms of UX as well, again, feel free to file a follow-up issue for that (I need to think a bit more about this, but I may do so myself).