-
Notifications
You must be signed in to change notification settings - Fork 68
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
Link to a specific tab #160
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Just in case my request was a bit too vague, here is a link to a question on stackoverflow that addresses exactly what I am trying to do, that is, create a link that will open a page with a certain desired tab open: https://stackoverflow.com/questions/10337814/how-can-i-link-directly-to-a-specific-javascript-tab in particular it would be great if sphinx-tabs could generate a href for each tab, just like in the stackoverflow example:
however, despite the fact that in each tab definition I follow the directions to add Cross-referencing arbitrary locations, with for example:
an href to the particular tab is not created. I guess an alternative would be to create a link that executes a javascript command (the one that changes the tab to the desired view). I have been trying to look under the hood at tabs.js but I am not too sure I have identified what would be the javascript command that changes the tab (something along the lines of: https://stackoverflow.com/questions/688196/how-to-use-a-link-to-call-javascript). Any ideas on how to do so? Thanks for such a great sphinx extension!!! |
Thanks for the feature request and suggestion for the implementation 😊 We've had similar requests in the past, about linking to load on a specific tab in a specific tab set (i.e. Open part way down a page and with the tab changed). However, just linking to open a specific tab on the the whole group would be much more feasible. As you suggest, we could trigger a tab change on load based on something passed in the URL. This could either call the change tab method directly or could set the tab via the session object, which we use to open the last selected tab on a page change. I guess we might need some validation on the passed tab name too, or at least check what happens when the tab name doesn't exist. Is this something you'd like to try to implement? Otherwise, I might be able to make a start some time next week |
Out of curiosity, has there been any progress on this? |
Not yet I'm afraid, but may take a look soon if there's still interest :) I'm not clear if the need is to:
|
Both have their uses, sure, but wouldn't it be more straightforward to treat things as a regular anchor first and foremost? and, then as an extension, if the active/anchored tab is a grouped tab, all other linked tabs should switch to the active tab sort of as a default. That said, I am not familiar with the code, so not sure how easy that would be to implement. |
@foster999 yes there is interest :) For the time being I have implemented the JS solution given here: https://github.com/readthedocs/readthedocs.org/blob/main/docs/_static/js/expand_tabs.js but this is far from ideal for the following reasons:
What we would really need is for the tabs to have anchors, see for example: https://www.tensorflow.org/install/pip#macos this is much better than telling your users navigate to page such and such and click on the tab "macOS." What would it take to implement something like this? Thanks in advance :) |
Context
Ability to generate a link to a page containing tabs with a specific tab open (different than the one open by default, generally the first). This would be an awesome feature. I am sure it has been already asked but I am not sure I was able to find a direct answer. Thanks!
Proposal
Ability to generate a link to a page containing tabs with a specific tab open (different than the one open by default, generally the first).
Tasks and updates
No response
The text was updated successfully, but these errors were encountered: