Skip to content

Commit

Permalink
Scrollbars appear on Creator Preview and Theme tabs (#8291)
Browse files Browse the repository at this point in the history
Fixes #8289

Co-authored-by: Aleksey Novikov <novikov@abrisplatform.com>
  • Loading branch information
novikov82 and Aleksey Novikov committed May 18, 2024
1 parent 2d9c7a8 commit debb742
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/defaultCss/defaultV2Css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export var defaultV2Css = {
rootFitToContainer: "sd-root-modern--full-container",
rootWrapper: "sd-root-modern__wrapper",
rootWrapperFixed: "sd-root-modern__wrapper--fixed",
rootWrapperHasImage: "sd-root-modern__wrapper--has-image",
rootBackgroundImage: "sd-root_background-image",
container: "sd-container-modern",
header: "sd-title sd-container-modern__title",
Expand Down
3 changes: 3 additions & 0 deletions src/defaultV2-theme/defaultV2.fontless.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ body {

.sd-root-modern__wrapper {
position: relative;
}

.sd-root-modern__wrapper--has-image {
min-height: 100%;
}

Expand Down
9 changes: 7 additions & 2 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,11 @@ export class SurveyModel extends SurveyElementCore
* An image to display in the background of the survey or form. Accepts a base64 or URL string value.
* @see backgroundOpacity
*/
@property() backgroundImage: string;
@property({
onSet: (newValue, target: SurveyModel) => {
target.updateCss();
}
}) backgroundImage: string;
@property() renderBackgroundImage: string;
private updateRenderBackgroundImage(): void {
const path = this.backgroundImage;
Expand Down Expand Up @@ -2213,7 +2217,8 @@ export class SurveyModel extends SurveyElementCore
public updateWrapperFormCss(): void {
this.wrapperFormCss = new CssClassBuilder()
.append(this.css.rootWrapper)
.append(this.css.rootWrapperFixed, this.backgroundImageAttachment === "fixed")
.append(this.css.rootWrapperHasImage, !!this.backgroundImage)
.append(this.css.rootWrapperFixed, !!this.backgroundImage && this.backgroundImageAttachment === "fixed")
.toString();
}
/**
Expand Down
10 changes: 10 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19672,3 +19672,13 @@ QUnit.test("getContainerContent - do not show buttons progress in the single pag
assert.deepEqual(getContainerContent("left"), [], "");
assert.deepEqual(getContainerContent("right"), [], "");
});
QUnit.test("Display mode in design time", function (assert) {
const survey = new SurveyModel();
assert.equal(survey.wrapperFormCss, "sd-root-modern__wrapper");

survey.backgroundImage = "abc";
assert.equal(survey.wrapperFormCss, "sd-root-modern__wrapper sd-root-modern__wrapper--has-image");

survey.backgroundImageAttachment = "fixed";
assert.equal(survey.wrapperFormCss, "sd-root-modern__wrapper sd-root-modern__wrapper--has-image sd-root-modern__wrapper--fixed");
});

0 comments on commit debb742

Please sign in to comment.