Skip to content

Commit a0b2203

Browse files
committed
MC-4294: Cannot Activate Tab Item After Moving Tabs or Slider to New Parent Container
Allow support for switching to active tab after a re-render of tabs
1 parent e2c6f48 commit a0b2203

File tree

2 files changed

+7
-2
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+7
-2
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/tabs/preview.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/tabs/preview.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import PreviewCollection from "../preview-collection";
3636
*/
3737
export default class Preview extends PreviewCollection {
3838
public focusedTab: KnockoutObservable<number> = ko.observable(null);
39+
public activeTab: KnockoutObservable<number> = ko.observable(0);
3940
private disableInteracting: boolean;
4041
private element: Element;
4142
private ready: boolean;
@@ -178,6 +179,8 @@ export default class Preview extends PreviewCollection {
178179
if (index !== null) {
179180
$(this.element).tabs("option", "active", index);
180181

182+
this.activeTab(index);
183+
181184
events.trigger("contentType:redrawAfter", {
182185
id: this.parent.id,
183186
contentType: this,
@@ -426,7 +429,7 @@ export default class Preview extends PreviewCollection {
426429
*
427430
* @type {(() => void) & _.Cancelable}
428431
*/
429-
private buildTabs(activeTabIndex = this.previewData.default_active() as number || 0) {
432+
private buildTabs(activeTabIndex = (this.activeTab() || this.previewData.default_active()) as number || 0) {
430433
this.ready = false;
431434
if (this.element && this.element.children.length > 0) {
432435
const focusedTab = this.focusedTab();

0 commit comments

Comments
 (0)