squidfunk / mkdocs-material

Documentation that simply works

Home Page:https://squidfunk.github.io/mkdocs-material/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_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

  1. Visit https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#anchor-links
  2. Click on the link jump to the third tab above this paragraph.
  3. The tab ... or even me is focused (Expected)
  4. Click on any other tab.
  5. 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.