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

[v2]: fallback for tab choice (groupId) #2885

Closed
LukasGentele opened this issue Jun 4, 2020 · 3 comments
Closed

[v2]: fallback for tab choice (groupId) #2885

LukasGentele opened this issue Jun 4, 2020 · 3 comments
Labels
difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship

Comments

@LukasGentele
Copy link
Contributor

🚀 Feature

When setting groupId on Tabs, it switches the tab selection for all tabs in this group and also stores the state in localStorage which is great. However, if there is a tab where one option is missing and this option is the selected one by using another tabs object of the same group with more choices, it looks kind of weird if no tab is selected. (see Motivation below for a real-world example)

Just falling back to the first TabItem would be one option. Alternatively, there could be a property for Tabs called fallbackTab or so which could reference TabItem.value. Yet another option would be to use the value of Tabs.defaultValue.

I would have opened a PR but I'm not sure which option the maintainers may prefer.

Have you read the Contributing Guidelines on issues?

y

Motivation

Example use case: You have a docs site where you show how to do things with UI, API and CLI. You are using tabs, so users can switch between UI, API and CLI. Some features however, are not available in the UI for example, i.e. there are tabs with all 3 options and some with only API and CLI.

Pitch

(Please explain why this feature should be implemented and how it would be used.)

@LukasGentele LukasGentele added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Jun 4, 2020
@yangshun yangshun removed the status: needs triage This issue has not been triaged by maintainers label Jun 5, 2020
@yangshun
Copy link
Contributor

yangshun commented Jun 5, 2020

PRs welcome :)

I think falling back on the first item might be easier but I'm not sure whether I'm missing something here. cc @SamChou19815 (who built this) for opinions.

@yangshun yangshun added mlh Major League Hacking Fellowship difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. labels Jun 5, 2020
@SamChou19815
Copy link
Contributor

SamChou19815 commented Jun 6, 2020

I put up a fix in #2893 that avoids updating a local choice is the chosen one is missing. I think this is the most intuitive option. @LukasGentele does that look good to you?

@LukasGentele
Copy link
Contributor Author

@SamChou19815 This is definitely the easiest solution. Great idea. Thanks for fixing this so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship
Projects
None yet
Development

No branches or pull requests

3 participants