? Success
Referenced as Duplicate of: # 6861 Related to: # 6902

User tests: Successful: Unsuccessful:

avatar gunjanpatel
gunjanpatel
13 Feb 2015

To reproduce the issue

Do this before applyting patch

Add the following code in any joomla template file (for example: <any-component>/views/tmpl/default.php)

// We are setting start offset to 2 and setting browser storage to false
$options = array(
    'startOffset' => 2,
    'useCookie'   => false
);

echo JHtml::_('tabs.start', 'pane', $options);

echo JHtml::_('tabs.panel', "Tab1", 'tab1');

    echo "Tab1 content";

echo JHtml::_('tabs.panel', 'Tab2', 'tab2');

    echo "Tab2 content";

echo JHtml::_('tabs.panel', 'Tab3', 'tab3');

    echo "Tab3 content";

echo JHtml::_('tabs.panel', 'Tab4', 'tab4');

    echo "Tab4 content";
echo JHtml::_('tabs.end');

Ideally you should have open Tab3 as we have set offset to 2. Now, if you have Tab1 as selected then select Tab2 and simply refresh the page. We have disabled the broweser storage, it means Tab3 should be selected. But it's not.

Reason:

https://github.com/joomla/joomla-cms/blob/staging/media/system/js/tabs.js#L45 this line of code is expecting boolean but when you will check in cosole with code,

console.log(typeof this.options.useStorage);

it will show string and because of that condition in above file always become true.

Test & Confirm fix

Apply this patch and confirm with enabling or disabling browser storage.

avatar gunjanpatel gunjanpatel - open - 13 Feb 2015
avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 13 Feb 2015
Easy No Yes
avatar zero-24 zero-24 - change - 13 Feb 2015
Category Libraries
avatar Erftralle
Erftralle - comment - 14 Feb 2015

@test:
I can confirm the bug.
After applying the patch and setting 'useCookie' to false always Tab3 is opened (first and subsequent loads).
After applying the patch and setting 'useCookie' to true Tab1 is opened on first load and the last selected tab on all subsequent loads.

So the patch works like expected regarding to the bug with 'useCookie', but the 'startOffset' seems to be ineffective when setting 'useCookie' to true. Maybe another bug?

avatar gunjanpatel
gunjanpatel - comment - 16 Feb 2015

Thanks @Erftralle for testing.

Yes, agree with you that when using useCookie true and trying to set startOffset is doesn't work because it's conflict with browser localStorage or cookie. That's the another bug and it can be fixed by resetting localStorage (assumption) not pratically tested.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6080.
avatar designbengel designbengel - test_item - 14 Mar 2015 - Tested successfully
avatar roland-d roland-d - alter_testresult - 6 May 2015 - Erftralle: Tested successfully
avatar roland-d roland-d - test_item - 6 May 2015 - Tested successfully
avatar roland-d
roland-d - comment - 6 May 2015

@test works as described. Before the patch, the chosen tab is not selected, after applying path the chosen tab is selected.

avatar roland-d roland-d - change - 6 May 2015
Milestone Added:
avatar roland-d roland-d - reference | 702129d - 6 May 15
avatar roland-d roland-d - merge - 6 May 2015
avatar roland-d roland-d - close - 6 May 2015
avatar roland-d roland-d - change - 6 May 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-05-06 05:22:59
Closed_By roland-d
avatar roland-d roland-d - close - 6 May 2015
avatar gunjanpatel gunjanpatel - head_ref_deleted - 6 May 2015
avatar gunjanpatel gunjanpatel - reference | a01486b - 7 May 15
avatar gunjanpatel gunjanpatel - reference | e8cccbc - 4 Sep 15
avatar Kubik-Rubik Kubik-Rubik - change - 7 May 2016
Milestone Added:
avatar Kubik-Rubik Kubik-Rubik - change - 7 May 2016
Milestone Removed:
avatar Kubik-Rubik Kubik-Rubik - change - 7 May 2016
Milestone Added:
avatar Kubik-Rubik Kubik-Rubik - change - 7 May 2016
Milestone Removed:
avatar Kubik-Rubik Kubik-Rubik - reference | c3569e0 - 7 May 16

Add a Comment

Login with GitHub to post a comment