When an anchor link to a content tab is clicked and you click on another tab, then clicking on the anchor link doesn't focus the tab.
Ultra-Instinct-05 opened this issue · comments
Contribution guidelines
- I've read the contribution guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the problem doesn't occur with the
mkdocs
orreadthedocs
themes - ... the problem persists when all overrides are removed, i.e.
custom_dir
,extra_javascript
andextra_css
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
Exactly as the description says. I don't think I can make it any clearer than that
Expected behaviour
The link should always focus the tab.
Actual behaviour
The link currently doesn't focus the tab once another tab is clicked.
Steps to reproduce
- Visit https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#anchor-links
- Click on the link
jump to the third tab above this paragraph
. - The tab
... or even me
is focused (Expected) - Click on any other tab.
- Now click on
jump to the third tab above this paragraph
again. It doesn't focus as in Step 2.
Package versions
Not required
Configuration
Configuration not needed as it can be easily reproduced on the website.
System information
- Operating system: Windows 11
- Browser: Firefox 101
Thanks for reporting! Fixed in ddffb9d
. The reason for this behavior was that the URL already contained the anchor link target, e.g. #__tabbed_1_1
, and the browser just ignores it when it's already set. The linked commit will now always set the link target, also when just clicking directly on the content tabs. This ensures that you can immediately share the link after clicking on a content tab.
Additionally, this commit ensures that the whole area of the tab is the anchor link. Before, only the link stretched only as far as the text area, as the padding is defined one level higher on the label. This makes clicking on tabs more predictable.
The change is already deployed on the official documentation, so feel free to test-drive:
https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#__tabbed_1_3
Can confirm it's fixed ! Thank you so much.