Skip to content

Commit

Permalink
#6022 Limit area for property grid drop-down
Browse files Browse the repository at this point in the history
Fixes #6022
  • Loading branch information
novikov82 committed Nov 13, 2024
1 parent 7c2d23c commit 5eafd68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
22 changes: 22 additions & 0 deletions functionalTests/designer/surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,26 @@ test("Check page adorner state is restored after shrink and stretch", async (t)
await t.expect(Selector(".svc-page__content-actions #duplicate .svc-page-toolbar-item__title--with-icon").visible).notOk();
await t.resizeWindow(1920, 1080);
await t.expect(Selector(".svc-page__content-actions #duplicate .svc-page-toolbar-item__title--with-icon").visible).ok();
});
test("Popup position", async (t) => {
const setCreatorTop = ClientFunction((top) => {
const el = document.getElementById("survey-creator") as HTMLElement;
el.style.top = top;
document.body.insertBefore(el, document.body.firstChild);
});
await setCreatorTop("400px");

await t.resizeWindow(1400, 900);
await setJSON({
"elements": [
{
"type": "text",
"name": "q1"
}
]
});
await t.click('button[title="Survey settings"]');
await t.click('[data-name="locale"]');
await t.expect(ClientFunction(() => { return document.querySelector('[data-name="locale"] .sv-popup__container')?.getBoundingClientRect().top; })()).gte(400);
await setCreatorTop(0);
});
4 changes: 3 additions & 1 deletion packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,9 @@ export class SurveyCreatorModel extends Base
this.onPreviewSurveyCreated.fire(this, { survey: survey });
}

survey.onPopupVisibleChanged.add((_, options) => options.popup.getAreaCallback = () => this.rootElement);
survey.onPopupVisibleChanged.add((_, options) => {
if (!options.popup.getAreaCallback) options.popup.getAreaCallback = () => { return this.rootElement; };
});
return survey;
}
private getSurveyInstanceCreatedArea(reason: string): string {
Expand Down

0 comments on commit 5eafd68

Please sign in to comment.