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

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. #3988

Closed
5 tasks done
Ultra-Instinct-05 opened this issue Jun 4, 2022 · 3 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@Ultra-Instinct-05
Copy link

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
@squidfunk squidfunk added the bug Issue reports a bug label Jun 4, 2022
@squidfunk
Copy link
Owner

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.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Jun 5, 2022
@squidfunk
Copy link
Owner

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

@Ultra-Instinct-05
Copy link
Author

Can confirm it's fixed ! Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants