Skip to content

Commit

Permalink
work for imagepicker a11y (#9235)
Browse files Browse the repository at this point in the history
* work for imagepicker a11y

* Update markup etalons

---------

Co-authored-by: dmitrykurmanov <[email protected]>
  • Loading branch information
dk981234 and dmitry-kurmanov authored Dec 30, 2024
1 parent a837642 commit bcbf9a9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/>
<div [class]="question.cssClasses.itemDecorator">
<div [class]="question.cssClasses.imageContainer">
<span *ngIf="question.cssClasses.checkedItemDecorator" [class]="question.cssClasses.checkedItemDecorator">
<span *ngIf="question.cssClasses.checkedItemDecorator" [class]="question.cssClasses.checkedItemDecorator" aria-hidden="true">
<svg *ngIf="question.cssClasses.checkedItemSvgIconId" [class]="question.cssClasses.checkedItemSvgIcon" [iconName]="question.cssClasses.checkedItemSvgIconId" [size]="'auto'" sv-ng-svg-icon></svg>
</span>
<img *ngIf="model.locImageLink.renderedHtml && !model.contentNotLoaded && question.contentMode === 'image'" [class]="question.cssClasses.image" [attr.src]="model.locImageLink.renderedHtml" [attr.width]="question.renderedImageWidth" [attr.height]="question.renderedImageHeight" [attr.alt]="model.locText.renderedHtml" [style.objectFit]="question.imageFit" (load)="question.onContentLoaded(model, $event)" (error)="model.onErrorHandler()"/>
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-react-ui/src/imagepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class SurveyQuestionImagePickerItem extends ReactSurveyElement {
<div className={this.question.cssClasses.itemDecorator}>
<div className={this.question.cssClasses.imageContainer}>
{!!this.question.cssClasses.checkedItemDecorator ?
<span className={this.question.cssClasses.checkedItemDecorator}>
<span className={this.question.cssClasses.checkedItemDecorator} aria-hidden="true">
{!!this.question.cssClasses.checkedItemSvgIconId ? <SvgIcon size={"auto"} className={this.question.cssClasses.checkedItemSvgIcon} iconName={this.question.cssClasses.checkedItemSvgIconId}></SvgIcon> : null}
</span> : null}
{control}
Expand Down
1 change: 1 addition & 0 deletions packages/survey-vue3-ui/src/ImagepickerItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<span
v-if="question.cssClasses.checkedItemDecorator"
:class="question.cssClasses.checkedItemDecorator"
aria-hidden="true"
>
<SvComponent
:is="'sv-svg-icon'"
Expand Down
2 changes: 1 addition & 1 deletion src/knockout/templates/question-imagepicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div data-bind="css: question.cssClasses.itemDecorator">
<div data-bind="css: question.cssClasses.imageContainer">
<!-- ko if: question.cssClasses.checkedItemDecorator -->
<span data-bind="css: question.cssClasses.checkedItemDecorator">
<span data-bind="css: question.cssClasses.checkedItemDecorator" aria-hidden="true">
<!-- ko if: question.cssClasses.checkedItemSvgIconId -->
<!-- ko component: { name: 'sv-svg-icon', params: { css: question.cssClasses.checkedItemSvgIcon, iconName: question.cssClasses.checkedItemSvgIconId, size: 'auto' } } -->
<!-- /ko -->
Expand Down
2 changes: 1 addition & 1 deletion src/vue/imagepicker-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
:class="question.cssClasses.itemControl"
/><div :class="question.cssClasses.itemDecorator">
<div :class="question.cssClasses.imageContainer">
<span v-if="question.cssClasses.checkedItemDecorator" :class="this.question.cssClasses.checkedItemDecorator">
<span v-if="question.cssClasses.checkedItemDecorator" :class="this.question.cssClasses.checkedItemDecorator" aria-hidden="true">
<sv-svg-icon v-if="question.cssClasses.checkedItemSvgIconId" v-bind:class="question.cssClasses.checkedItemSvgIcon" size="auto" :iconName="question.cssClasses.checkedItemSvgIconId"></sv-svg-icon>
</span>
<img
Expand Down
4 changes: 2 additions & 2 deletions tests/markup/snapshots/imagepicker-colCount-1-v2.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" id="testid0i_0" name="question1_testid0" type="radio" value="item1">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand All @@ -21,7 +21,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" id="testid0i_1" name="question1_testid0" type="radio" value="item2">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand Down
4 changes: 2 additions & 2 deletions tests/markup/snapshots/imagepicker-colCount-2-v2.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" id="testid0i_0" name="question1_testid0" type="radio" value="item1">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand All @@ -24,7 +24,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" id="testid0i_1" name="question1_testid0" type="radio" value="item2">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand Down
4 changes: 2 additions & 2 deletions tests/markup/snapshots/imagepicker-no-image-v2.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" disabled="" id="testid0i_0" name="question1_testid0" type="radio" value="item1">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand All @@ -26,7 +26,7 @@
<input aria-invalid="false" aria-label="question1" aria-required="false" class="sd-imagepicker__control sd-visuallyhidden" disabled="" id="testid0i_1" name="question1_testid0" type="radio" value="item2">
<div class="sd-imagepicker__item-decorator">
<div class="sd-imagepicker__image-container">
<span class="sd-imagepicker__check-decorator">
<span aria-hidden="true" class="sd-imagepicker__check-decorator">
<svg class="sd-imagepicker__check-icon sv-svg-icon" role="img">
<use xlink:href="#icon-check-24x24" class="">
</use>
Expand Down

0 comments on commit bcbf9a9

Please sign in to comment.