User tests: Successful: Unsuccessful:
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.
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
.
Apply this patch and confirm with enabling or disabling browser storage.
Labels |
Added:
?
|
Easy | No | ⇒ | Yes |
Category | ⇒ | Libraries |
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.
Milestone |
Added: |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-06 05:22:59 |
Closed_By | ⇒ | roland-d |
Milestone |
Added: |
Milestone |
Removed: |
Milestone |
Added: |
Milestone |
Removed: |
@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?