diff --git a/packages/survey-core/src/actions/adaptive-container.ts b/packages/survey-core/src/actions/adaptive-container.ts index 376a86faee..3e4f6431a3 100644 --- a/packages/survey-core/src/actions/adaptive-container.ts +++ b/packages/survey-core/src/actions/adaptive-container.ts @@ -152,8 +152,11 @@ export class AdaptiveActionContainer extends ActionCo } public setActionsMode(mode: actionModeType) { this.actions.forEach((action) => { - if (mode == "small" && action.disableShrink) return; - action.mode = mode; + if(mode == "small" && action.disableShrink) { + action.mode = "large"; + } else { + action.mode = mode; + } }); } public dispose(): void { diff --git a/packages/survey-core/src/dropdownListModel.ts b/packages/survey-core/src/dropdownListModel.ts index cc4504aafe..95bf748c98 100644 --- a/packages/survey-core/src/dropdownListModel.ts +++ b/packages/survey-core/src/dropdownListModel.ts @@ -633,6 +633,7 @@ export class DropdownListModel extends Base { if (!!this.popupModel) { this.popupModel.dispose(); } + this.htmlCleanerElement = undefined; } scrollToFocusedItem(): void { diff --git a/packages/survey-core/src/survey.ts b/packages/survey-core/src/survey.ts index f0229003a8..578bb0d76b 100644 --- a/packages/survey-core/src/survey.ts +++ b/packages/survey-core/src/survey.ts @@ -4976,6 +4976,11 @@ export class SurveyModel extends SurveyElementCore this.rootElement = htmlElement; this.addScrollEventListener(); } + beforeDestroySurveyElement() { + this.destroyResizeObserver(); + this.removeScrollEventListener(); + this.rootElement = undefined; + } /** * An event that is raised when the survey's width or height is changed. */ diff --git a/packages/survey-core/tests/responsivityTests.ts b/packages/survey-core/tests/responsivityTests.ts index ed3d686050..16276dcf2f 100644 --- a/packages/survey-core/tests/responsivityTests.ts +++ b/packages/survey-core/tests/responsivityTests.ts @@ -593,4 +593,21 @@ QUnit.test("check title change calls raise update", function (assert) { assert.equal(log, "->called: true->called: true", "called from title change"); item1.title = "Test"; assert.equal(log, "->called: true->called: true"); +}); + +QUnit.test("check actions mode is set correctly when disableShrink is set", function (assert) { + const model: AdaptiveActionContainer = new AdaptiveActionContainer(); + const action = model.addAction({ + disableShrink: true, + title: "test" + }); + assert.equal(action.mode, "large"); + model.setActionsMode("removed"); + assert.equal(action.mode, "removed"); + model.setActionsMode("large"); + assert.equal(action.mode, "large"); + model.setActionsMode("popup"); + assert.equal(action.mode, "popup"); + model.setActionsMode("small"); + assert.equal(action.mode, "large"); }); \ No newline at end of file diff --git a/packages/survey-vue3-ui/src/Survey.vue b/packages/survey-vue3-ui/src/Survey.vue index 8fb8a997f2..7d558074c3 100644 --- a/packages/survey-vue3-ui/src/Survey.vue +++ b/packages/survey-vue3-ui/src/Survey.vue @@ -209,7 +209,7 @@ onMounted(() => { onUnmounted(() => { vueSurvey.value.stopTimer(); - vueSurvey.value.rootElement = undefined as any; + vueSurvey.value.beforeDestroySurveyElement(); vueSurvey.value.renderCallback = undefined as any; }); diff --git a/packages/survey-vue3-ui/src/selectbase-item.ts b/packages/survey-vue3-ui/src/selectbase-item.ts index c1f58a050f..f8245a2cfe 100644 --- a/packages/survey-vue3-ui/src/selectbase-item.ts +++ b/packages/survey-vue3-ui/src/selectbase-item.ts @@ -1,5 +1,5 @@ import type { ItemValue, QuestionSelectBase } from "survey-core"; -import { onMounted, type Ref } from "vue"; +import { onMounted, onUnmounted, type Ref } from "vue"; import { useBase } from "./base"; export function useSelectBaseItem( @@ -14,24 +14,19 @@ export function useSelectBaseItem( } } }); - useBase( - getItem, - (newValue, oldValue) => { - if (!getQuestion().isDesignMode) { - if (newValue && root.value) { - newValue.setRootElement(root.value); - } - if (oldValue) { - oldValue.setRootElement(undefined as any); - } + onUnmounted(() => { + if (!getQuestion().isDesignMode) { + getItem().setRootElement(undefined as any); + } + }); + useBase(getItem, (newValue, oldValue) => { + if (!getQuestion().isDesignMode) { + if (newValue && root.value) { + newValue.setRootElement(root.value); } - }, - () => { - const item = getItem(); - const question = getQuestion(); - if (question && item && question.isDesignMode) { - item.setRootElement(undefined as any); + if (oldValue) { + oldValue.setRootElement(undefined as any); } } - ); + }); }