Skip to content

Commit

Permalink
#7440 WAVE Alert (Level A and Level AA) - Skipped heading level becau…
Browse files Browse the repository at this point in the history
…se a survey title uses H5 and survey description uses H3 - The H4 tag is missing

Fixes #7440
  • Loading branch information
novikov82 committed Dec 6, 2023
1 parent 33ea3f2 commit 3999607
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<sv-ng-element-title [element]="model.survey"></sv-ng-element-title>
</div>
<div *ngIf="model.showDescription" class="sv-header__description" [style]="{ maxWidth: model.textAreaWidth }">
<h5 *ngIf="model.survey.renderedHasDescription" [class]="model.survey.css.description" [model]="model.survey.locDescription" sv-ng-string></h5>
<div *ngIf="model.survey.renderedHasDescription" [class]="model.survey.css.description" [model]="model.survey.locDescription" sv-ng-string></div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<sv-ng-element-title [element]="model.survey"></sv-ng-element-title>
</div>
<div *ngIf="model.survey.renderedHasDescription" class="sv-header__description" [style]="{ maxWidth: model.textAreaWidth }">
<h5 *ngIf="model.survey.renderedHasDescription" [class]="model.survey.css.description" [model]="model.survey.locDescription" sv-ng-string></h5>
<div *ngIf="model.survey.renderedHasDescription" [class]="model.survey.css.description" [model]="model.survey.locDescription" sv-ng-string></div>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[style.maxWidth]="survey.titleMaxWidth"
>
<sv-ng-element-title [element]="survey"></sv-ng-element-title>
<h5 *ngIf="survey.renderedHasDescription" [class]="survey.css.description" [model]="survey.locDescription" sv-ng-string></h5>
<div *ngIf="survey.renderedHasDescription" [class]="survey.css.description" [model]="survey.locDescription" sv-ng-string></div>
</div>

<ng-template *ngIf="survey.isLogoAfter" [component]="{ name: survey.getElementWrapperComponentName(survey, 'logo-image'), data: { data: survey.getElementWrapperComponentData(survey, 'logo-image') } }"></ng-template>
Expand Down
6 changes: 3 additions & 3 deletions packages/survey-vue3-ui/src/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
v-bind:style="{ maxWidth: survey.titleMaxWidth }"
>
<survey-element-title :element="survey" :css="survey.css" />
<h5 v-if="survey.renderedHasDescription" :class="survey.css.description">
<survey-string :locString="survey.locDescription" />
</h5>
<div v-if="survey.renderedHasDescription" :class="survey.css.description">
<survey-string :locString="survey.locDescription" />
</div>
</div>

<component v-if="survey.isLogoAfter"
Expand Down
4 changes: 2 additions & 2 deletions packages/survey-vue3-ui/src/components/header/HeaderCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
class="sv-header__description"
:style="{ maxWidth: model.textAreaWidth }"
>
<h5
<div
v-if="model.survey.renderedHasDescription"
:class="model.survey.css.description"
>
<survey-string :locString="model.survey.locDescription" />
</h5>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<survey-element-title :element="model.survey" :css="model.survey.css" />
</div>
<div v-if="model.survey.renderedHasDescription" class="sv-header__description" :style="{ 'maxWidth': model.textAreaWidth }">
<h5 v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<div v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<survey-string :locString="model.survey.locDescription" />
</h5>
</div>
</div>
</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/knockout/components/header/cell.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<!-- /ko -->
<!-- ko if: showDescription -->
<div class="sv-header__description" data-bind="style: { maxWidth: textAreaWidth }">
<h5 data-bind="css: survey.css.description">
<div data-bind="css: survey.css.description">
<!-- ko template: { name: 'survey-string', data: survey.locDescription } -->
<!-- /ko -->
</h5>
</div>
</div>
<!-- /ko -->
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/knockout/components/header/mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<!-- /ko -->
<!-- ko if: survey.renderedHasDescription -->
<div class="sv-header__description" data-bind="style: { maxWidth: textAreaWidth }">
<h5 data-bind="css: survey.css.description">
<div data-bind="css: survey.css.description">
<!-- ko template: { name: 'survey-string', data: survey.locDescription } -->
<!-- /ko -->
</h5>
</div>
</div>
<!-- /ko -->
</div>
4 changes: 2 additions & 2 deletions src/knockout/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<!-- ko component: { name: 'survey-element-title', params: {element: $data } } -->
<!-- /ko -->
<!-- ko if: renderedHasDescription -->
<h5 data-bind="css: css.description">
<div data-bind="css: css.description">
<!-- ko template: { name: 'survey-string', data: locDescription } -->
<!-- /ko -->
</h5>
</div>
<!-- /ko -->
</div>
<!-- /ko -->
Expand Down
8 changes: 4 additions & 4 deletions src/react/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export class HeaderMobile extends React.Component<any, any> {
<TitleElement element={this.model.survey}/>
</div>) : null}
{this.model.survey.renderedHasDescription ? (<div className="sv-header__description" style={{ maxWidth: this.model.textAreaWidth }}>
<h5 className={this.model.survey.css.description}>
<div className={this.model.survey.css.description}>
{SurveyElementBase.renderLocString(this.model.survey.locDescription)}
</h5>
</div>
</div>) : null}
</div>);
}
Expand Down Expand Up @@ -74,9 +74,9 @@ export class HeaderCell extends React.Component<any, any> {
<TitleElement element={this.model.survey}/>
</div>) : null}
{this.model.showDescription ? (<div className="sv-header__description" style={{ maxWidth: this.model.textAreaWidth }}>
<h5 className={this.model.survey.css.description}>
<div className={this.model.survey.css.description}>
{SurveyElementBase.renderLocString(this.model.survey.locDescription)}
</h5>
</div>
</div>) : null}
</div>
</div>);
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/survey-header/survey-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class SurveyHeader extends React.Component<ISurveyHeaderProps, any> {
style={{ maxWidth: this.survey.titleMaxWidth }}
>
<TitleElement element={this.survey}></TitleElement>
{ this.survey.renderedHasDescription ? <h5 className={this.css.description}>{description}</h5> : null }
{this.survey.renderedHasDescription ? <div className={this.css.description}>{description}</div> : null}
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/header/header-cell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<survey-element-title :element="model.survey" :css="model.survey.css" />
</div>
<div v-if="model.showDescription" class="sv-header__description" :style="{ 'maxWidth': model.textAreaWidth }">
<h5 v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<div v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<survey-string :locString="model.survey.locDescription" />
</h5>
</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/header/header-mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<survey-element-title :element="model.survey" :css="model.survey.css" />
</div>
<div v-if="model.survey.renderedHasDescription" class="sv-header__description" :style="{ 'maxWidth': model.textAreaWidth }">
<h5 v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<div v-if="model.survey.renderedHasDescription" :class="model.survey.css.description">
<survey-string :locString="model.survey.locDescription" />
</h5>
</div>
</div>
</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/vue/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
v-bind:style="{ maxWidth: survey.titleMaxWidth }"
>
<survey-element-title :element="survey" :css="survey.css" />
<h5 v-if="survey.renderedHasDescription" :class="survey.css.description">
<div v-if="survey.renderedHasDescription" :class="survey.css.description">
<survey-string :locString="survey.locDescription" />
</h5>
</div>
</div>

<div v-if="survey.isLogoAfter" :class="survey.logoClassNames">
Expand Down
69 changes: 69 additions & 0 deletions tests/markup/etalon_survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,74 @@ registerMarkupTests(
div.appendChild(image);
return div;
}
},
{
name: "Test survey description",
json: {
"title": "Test",
"description": "Description",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "question1"
}
]
}
]
},
event: "onAfterRenderHeader",
snapshot: "survey-header"
},
{
name: "Test survey description - header advanced mode",
json: {
"title": "Test",
"description": "Description",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "question1"
}
]
}
],
"headerView": "advanced"
},
event: "onAfterRenderSurvey",
getSnapshot: el => {
return el.querySelector(".sv-header__cell.sv-header__cell--middle.sv-header__cell--right")?.outerHTML || "";
},
snapshot: "survey-header-advanced"
},
{
name: "Test survey description - header advanced mode mobile",
json: {
"title": "Test",
"description": "Description",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "question1"
}
]
}
],
"headerView": "advanced"
},
event: "onAfterRenderSurvey",
initSurvey: survey => survey.setIsMobile(true),
getSnapshot: el => {
return el.querySelector(".sv-header--mobile")?.outerHTML || "";
},
snapshot: "survey-header-advanced-mobile"
}
]);
12 changes: 12 additions & 0 deletions tests/markup/snapshots/survey-header-advanced-mobile.snap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="sv-header--mobile">
<div class="sv-header__title" style="max-width:512px;">
<h3 aria-label="Test">
<span class="sv-string-viewer">Test</span>
</h3>
</div>
<div class="sv-header__description" style="max-width:512px;">
<div>
<span class="sv-string-viewer">Description</span>
</div>
</div>
</div>
14 changes: 14 additions & 0 deletions tests/markup/snapshots/survey-header-advanced.snap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="sv-header__cell sv-header__cell--middle sv-header__cell--right" style="grid-area:2 / 3;">
<div class="sv-header__cell-content" style="align-items:flex-end; justify-content:center; text-align:end;">
<div class="sv-header__title" style="max-width:512px;">
<h3 aria-label="Test">
<span class="sv-string-viewer">Test</span>
</h3>
</div>
<div class="sv-header__description" style="max-width:512px;">
<div>
<span class="sv-string-viewer">Description</span>
</div>
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions tests/markup/snapshots/survey-header.snap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h3 aria-label="Test">
<span class="sv-string-viewer">Test</span>
</h3>
<div>
<span class="sv-string-viewer">Description</span>
</div>

0 comments on commit 3999607

Please sign in to comment.