collapsibleTabs: Stop the tabs from collapsing back and forth forever

Update the 'expandedWidth' after we expand in case someone was brazen
enough to change the tab's contents after the page load (gasp).

This doesn't prevent a tab from collapsing back and forth once, but at
least it won't continue to do that forever. This should reduce the
issue from completely awful to mildly annoying.

Bug: T71729
Change-Id: I46bd6584c0f2ddebc4aa7d1103cff1715e1510a5
This commit is contained in:
Bartosz Dziewoński 2017-01-12 14:26:31 -08:00
parent 490a72b92b
commit 532b9c0eaf
1 changed files with 9 additions and 2 deletions

View File

@ -172,8 +172,15 @@
.data( 'collapsibleTabsSettings', data )
.animate( { width: expandedWidth + 'px' }, 'normal', function () {
$( this ).attr( 'style', 'display: block;' );
expContainerSettings.shifting = false;
rAF( $.collapsibleTabs.handleResize );
rAF( function () {
// Update the 'expandedWidth' in case someone was brazen enough to change the tab's
// contents after the page load *gasp* (T71729). This doesn't prevent a tab from
// collapsing back and forth once, but at least it won't continue to do that forever.
data.expandedWidth = $moving.width();
$moving.data( 'collapsibleTabsSettings', data );
expContainerSettings.shifting = false;
$.collapsibleTabs.handleResize();
} );
} )
);
},