Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbars appear on Creator Preview and Theme tabs #8291

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
});
Loading