Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When a user goes to http://example.com/sometabpage, the page opens tab bar by default. If they go to tab foo and follow some random link in the pane and want to go back they are returned to the tab page with bar open instead of foo. This presented a problem for the site I was working on and my way around this was a bit of jquery on the theme level.
But I'm not too sure if that is the best way to do it. Any ideas?
//Add location to tabbed page
$('ul.ui-tabs-nav li a').click(function(){
var link =$(this)[0];
location.href=link;
return false;
});
Comment | File | Size | Author |
---|---|---|---|
#18 | panels_tabs-back_button_support-821334-18.patch | 1.04 KB | scalas89 |
| |||
#16 | panels_tabs-back_button_support-821334-16.patch | 994 bytes | brockfanning |
#14 | panels_tabs-back-button-support-821334-11.patch | 3.27 KB | neoxavier |
tabbedquestion.png | 17.12 KB | iamjon |
Comments
Comment #1
mansspams CreditAttribution: mansspams commentedsubscribing. this is issue with tabs i guess. its all because of ajax - i dont think ajax tabs is a priority, usability is - just give us proper URL for each tab...
Comment #2
smoothify CreditAttribution: smoothify commentedas mansspams mentions this would be something that needs to be added to the tabs module first.
Marking as a duplicate of #695020: Is there a way to save the last tab the user visited? in the tabs queue.
if something does get added then I will make sure it works in panels_tabs.
Comment #3
mstrelan CreditAttribution: mstrelan commentedIn Drupal 7 JQuery UI is in core, as is JQuery BBQ. That makes it easy for panels_tabs to implement this feature request as per http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui...
I have attached a patch which changes the javascript file to use jQuery BBQ.
Comment #4
mstrelan CreditAttribution: mstrelan commentedComment #5
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedgit apply *back*patch
panels_tabs_back_button_support.patch:12: trailing whitespace.
panels_tabs_back_button_support.patch:15: trailing whitespace.
panels_tabs_back_button_support.patch:18: trailing whitespace.
panels_tabs_back_button_support.patch:24: trailing whitespace.
panels_tabs_back_button_support.patch:28: trailing whitespace.
error: patch failed: js/panels_tabs.js:8
error: js/panels_tabs.js: patch does not apply
error: patch failed: plugins/styles/tabs.inc:30
error: plugins/styles/tabs.inc: patch does not apply
Comment #6
dcmouyard CreditAttribution: dcmouyard commentedI re-rolled the patch in #4 to follow Drupal's coding standards. This patch worked correctly for me.
Comment #7
maximpodorov CreditAttribution: maximpodorov commentedPlease re-roll for 7.x-2.x.
Does the patch solves #2175737: Save active tab after page reload which is the duplicate of this issue?
Comment #8
Yuri CreditAttribution: Yuri commentedI expected a submit button of a views exposed filter to return to the same panel pane tab. This currently does not happen with this patch.
Comment #9
Yuri CreditAttribution: Yuri commentedPlease re-roll the patch for 7.x-2.x-dev
Comment #10
neoxavier CreditAttribution: neoxavier commentedI rerolled the patch against the HEAD
Comment #11
neoxavier CreditAttribution: neoxavier commentedComment #14
neoxavier CreditAttribution: neoxavier commentedOpps sorry, there was netbeans files included in the patch.
This is the cleaner one
Comment #15
neoxavier CreditAttribution: neoxavier commentedI made a new patch that basically combination between patch from https://www.drupal.org/node/821334 and https://www.drupal.org/node/1560234 and I reroll it against the 2.x dev HEAD.
You can find it here https://www.drupal.org/node/2561029
Comment #16
brockfanning CreditAttribution: brockfanning commented@neoxavier, what do you think about using a localStorage approach? I was trying to get this working in combo with the Views Ajax History module, and that module was clobbering the URL changes. This is probably oversimplified, but it's working for me.
Comment #17
eigentor CreditAttribution: eigentor commentedFor me #16 worked nicely.
It also has the bonus of being rather short and using the modern localStorage Approach.
Comment #18
scalas89 CreditAttribution: scalas89 commentedPatch #16 works very well!
I added a single control if you want to force the opening of a tab.
Comment #20
brockfanning CreditAttribution: brockfanning commentedI did notice a problem with this patch, which is:
If you have 2 pages with similar tab setups, foo.html and bar.html, and you visit foo.html and you select the second tab, and then you visit bar.html, the second tab will be active. So I think there needs to be something to link the localStorage variable name to specific instances.