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;
});
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mansspams’s picture

subscribing. 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...

smoothify’s picture

Status: Active » Closed (duplicate)

as 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.

mstrelan’s picture

Version: 6.x-1.0-beta3 » 7.x-1.x-dev
Category: support » feature
Priority: Minor » Normal
Status: Closed (duplicate) » Needs review

In 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.

mstrelan’s picture

SocialNicheGuru’s picture

git 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

dcmouyard’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
3.78 KB

I re-rolled the patch in #4 to follow Drupal's coding standards. This patch worked correctly for me.

maximpodorov’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

Please 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?

Yuri’s picture

I 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.

Yuri’s picture

Please re-roll the patch for 7.x-2.x-dev

neoxavier’s picture

I rerolled the patch against the HEAD

neoxavier’s picture

Status: Needs work » Needs review

The last submitted patch, 4: panels_tabs_back_button_support.patch, failed testing.

The last submitted patch, 6: panels_tabs-back-button-support-821334-6.patch, failed testing.

neoxavier’s picture

Opps sorry, there was netbeans files included in the patch.

This is the cleaner one

neoxavier’s picture

I 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

brockfanning’s picture

@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.

eigentor’s picture

For me #16 worked nicely.
It also has the bonus of being rather short and using the modern localStorage Approach.

scalas89’s picture

Patch #16 works very well!
I added a single control if you want to force the opening of a tab.

Status: Needs review » Needs work

The last submitted patch, 18: panels_tabs-back_button_support-821334-18.patch, failed testing.

brockfanning’s picture

I 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.