Skip to content

Commit

Permalink
Fix showing description on empty survey in designer
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Sep 11, 2023
1 parent 6972949 commit aca20d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ export class PanelModelBase extends SurveyElement<Question>
protected canShowTitle(): boolean { return true; }
@property({ defaultValue: true }) showDescription: boolean;
get _showDescription(): boolean {
return this.survey && (<any>this.survey).showPageTitles && this.hasDescription && !this.isDesignMode ||
(this.showDescription && this.isDesignMode && this.showTitle &&
settings.designMode.showEmptyTitles &&
if(!this.hasTitle && this.isDesignMode) return false;
return this.survey && (<any>this.survey).showPageTitles && this.hasDescription ||
(this.showDescription && this.isDesignMode &&
settings.designMode.showEmptyDescriptions);
}
public localeChanged() {
Expand Down
2 changes: 1 addition & 1 deletion src/survey-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export abstract class SurveyElementCore extends Base implements ILocalizableOwne
const property: JsonObjectProperty = Serializer.findProperty(this.getType(), "description");
showPlaceholder = !!(property?.placeholder);
}
this.hasDescription = !!newDescription || showPlaceholder;
this.hasDescription = !!newDescription || (showPlaceholder && this.isDesignMode);
}

get locDescription(): LocalizableString {
Expand Down
4 changes: 4 additions & 0 deletions tests/paneltests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,10 @@ QUnit.test(
page._showDescription,
"Entered description is visible in DesignMode"
);
page.title = "";
page.description = "";
assert.notOk(page.hasTitle, "No title");
assert.notOk(page._showDescription, "No description");
}
);

Expand Down

0 comments on commit aca20d8

Please sign in to comment.