Update location.hash when clicking a vertical tab

Created on 21 June 2016, over 8 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

This ability to link to a vertical tab was introduced in #376293: Activate current vertical tab from URL fragment and has been merged. You currently can use the case-sensitive vertical tab id as the hash, but without knowing how this works users cannot link to specific tabs.

For example if I wanted to link a user to authoring information I would need to know that in Drupal 8 I would need to add #edit-author to the end of the URL. Ideally when authoring information is clicked the window hash should be updated to reflect the tab that is open.

Proposed resolution

When clicking the vertical tab, the URL in the browser should be updated with the relevant hash of the tab. If this URL is entered in to a new browser said tab should be open by default and brought in to the users view.

Before clicking on the vertical tab link switches the tab pane, but does not change the hash in the URL bar:

After clicking on the vertical tab link (including mouse and keydown) switches the tab pane AND changes the hash in the URL bar:

After pasting this URL with the preserved hash into a new window highlights the relevant tab and scrolls down to it:

Remaining tasks

Backport to 8.2.x (Should be the same patch)
Backport to 7.x potentially based on patch #2 which was created for 7.38

User interface changes

Minimal changes. A page with a hashed URL will be scrolled down, and focused on the relevant vertical tab. If the relevant tab is not the default open tab, the default will be closed and the tab from the hash will be opened.

API changes

N/A

Data model changes

N/A

Feature request
Status

Needs work

Version

10.0

Component
Javascript 

Last updated about 24 hours ago

Created by

🇺🇸United States Elijah Lynn Portland, Oregon

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Production build 0.71.5 2024