It would be nice to have the active tab set to the last tab that user clicked. This is especially helpful with complex multi-tab Quicktab instances where a user may want to use the 'back' navigation in their browser but not need to identify the Quicktab again.

Issue fork quicktabs-3035749

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

brooke_heaton created an issue. See original summary.

brooke_heaton’s picture

StatusFileSize
new1.72 KB

The attached patch adds a quicktabsmemory behavior to Drupal.behaviors in quicktabs.js and makes uses of jQuery Cookie to set the active tab to the last tab clicked. This is specific to the Quicktabs display.

brooke_heaton’s picture

StatusFileSize
new2.03 KB

Update patch to include addition of jquery.cookie library.

johnnydarkko’s picture

Status: Needs review » Reviewed & tested by the community
gibbo1715’s picture

I found initially this didn't work for me but if you have the same issue it is not the patch, it is to do with ensuring cookies are enabled in your browser. I had enabled the prevent cross site tracking on my Mac and that prevents this patch from working, just disable it and you are good to go.

markdc’s picture

This works for me. Thanks!

kekkis’s picture

Assigned: brooke_heaton » Unassigned
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.29 KB
new3.99 KB

I reorganised the patch, cleaned up some coding style (from PhpStorm suggestions), and changed the patch to use jQuery.data(). This way I could get this to work even when clicking on the tabs multiple times. With the #3 patch I could only get the cookie to be set once per each page load (if I wanted to reset the cookie into a different value between two tabs, I needed to reload the page).

sarathkm’s picture

Related issues: +#1454486: D7: Tab history

Pointing to drupal 7 version

  • shelane committed a76a604 on 8.x-3.x authored by kekkis
    Issue #3035749 by brooke_heaton, kekkis: Drupal 8 Tab History
    
shelane’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

manoxs made their first commit to this issue’s fork.