|
@@ -1130,7 +1130,6 @@ class UITabbedPanel extends UIDiv {
|
|
|
if ( tab ) {
|
|
|
|
|
|
tab.addClass( 'selected' );
|
|
|
- tab.dom.scrollIntoView( { inline: 'center', behavior: 'smooth' } );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1142,6 +1141,26 @@ class UITabbedPanel extends UIDiv {
|
|
|
|
|
|
this.selected = id;
|
|
|
|
|
|
+ // Scrolls to tab
|
|
|
+ if ( tab ) {
|
|
|
+
|
|
|
+ const tabOffsetRight = tab.dom.offsetLeft + tab.dom.offsetWidth;
|
|
|
+ const containerWidth = this.tabsDiv.dom.getBoundingClientRect().width;
|
|
|
+
|
|
|
+ if ( tabOffsetRight > containerWidth ) {
|
|
|
+
|
|
|
+ this.tabsDiv.dom.scrollTo( { left: tabOffsetRight - containerWidth, behavior: 'smooth' } );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( tab.dom.offsetLeft < this.tabsDiv.dom.scrollLeft ) {
|
|
|
+
|
|
|
+ this.tabsDiv.dom.scrollTo( { left: 0, behavior: 'smooth' } );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return this;
|
|
|
|
|
|
}
|