-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accessibility improvement for the add question button
- Loading branch information
1 parent
87c4d47
commit 70c85e4
Showing
7 changed files
with
153 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 39 additions & 13 deletions
52
packages/survey-creator-angular/src/add-question.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
<ng-template #template> | ||
<div *ngIf="adorner.showAddQuestionButton" [class]="'svc-element__add-new-question ' + buttonClass" [key2click] | ||
(click)="addNewQuestion($event)" | ||
(mouseover)="adorner.hoverStopper && adorner.hoverStopper($event, $event.currentTarget)" | ||
data-bind="clickBubble: false"> | ||
<svg class="svc-panel__add-new-question-icon" [iconName]="('icon-add_24x24')" [size]="'auto'" sv-ng-svg-icon></svg> | ||
<span class="svc-add-new-item-button__text"> | ||
{{ adorner.addNewQuestionText }} | ||
</span> | ||
<ng-template *ngIf="renderPopup" | ||
[component]="{ name: 'svc-add-question-type-selector', data: { questionTypeSelectorModel: adorner.questionTypeSelectorModel, renderPopup: renderPopup } }"> | ||
<div | ||
*ngIf="adorner.showAddQuestionButton" | ||
[class]="'svc-element__add-new-question ' + buttonClass" | ||
(mouseover)=" | ||
adorner.hoverStopper && adorner.hoverStopper($event, $event.currentTarget) | ||
" | ||
> | ||
<button [key2click] (click)="addNewQuestion($event)"> | ||
<svg | ||
class="svc-panel__add-new-question-icon" | ||
[iconName]="'icon-add_24x24'" | ||
[size]="'auto'" | ||
sv-ng-svg-icon | ||
></svg> | ||
<span class="svc-add-new-item-button__text"> | ||
{{ adorner.addNewQuestionText }} | ||
</span> | ||
</button> | ||
<ng-template | ||
*ngIf="renderPopup" | ||
[component]="{ | ||
name: 'svc-add-question-type-selector', | ||
data: { | ||
questionTypeSelectorModel: adorner.questionTypeSelectorModel, | ||
renderPopup: renderPopup | ||
} | ||
}" | ||
> | ||
</ng-template> | ||
</div> | ||
<ng-template *ngIf="!renderPopup" | ||
[component]="{ name: 'svc-add-question-type-selector', data: { questionTypeSelectorModel: adorner.questionTypeSelectorModel, renderPopup: renderPopup } }"> | ||
<ng-template | ||
*ngIf="!renderPopup" | ||
[component]="{ | ||
name: 'svc-add-question-type-selector', | ||
data: { | ||
questionTypeSelectorModel: adorner.questionTypeSelectorModel, | ||
renderPopup: renderPopup | ||
} | ||
}" | ||
> | ||
</ng-template> | ||
</ng-template> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 39 additions & 23 deletions
62
packages/survey-creator-vue/src/tabs/designer/AddQuestion.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,60 @@ | ||
<template> | ||
<div | ||
:class="rootCss" | ||
v-on:click=" | ||
(e) => { | ||
item.data.addNewQuestion(item, e); | ||
e.stopPropagation(); | ||
} | ||
v-on:mouseover=" | ||
(e) => | ||
item.data.hoverStopper && item.data.hoverStopper(e, e.currentTarget) | ||
" | ||
v-key2click | ||
v-on:mouseover="(e) => item.data.hoverStopper && item.data.hoverStopper(e, e.currentTarget)" | ||
> | ||
<SvComponent | ||
:is="'sv-svg-icon'" | ||
class="svc-panel__add-new-question-icon" | ||
:iconName="'icon-add_24x24'" | ||
:size="'auto'" | ||
></SvComponent> | ||
<span class="svc-add-new-item-button__text"> | ||
{{ item.data.addNewQuestionText }} | ||
</span> | ||
<button | ||
v-on:click=" | ||
(e) => { | ||
item.data.addNewQuestion(item, e); | ||
e.stopPropagation(); | ||
} | ||
" | ||
v-key2click | ||
> | ||
<SvComponent | ||
:is="'sv-svg-icon'" | ||
class="svc-panel__add-new-question-icon" | ||
:iconName="'icon-add_24x24'" | ||
:size="'auto'" | ||
></SvComponent> | ||
<span class="svc-add-new-item-button__text"> | ||
{{ item.data.addNewQuestionText }} | ||
</span> | ||
</button> | ||
<SvComponent | ||
:is="'svc-add-question-type-selector'" | ||
v-if="needRenderPopup" | ||
:questionTypeSelectorModel="item.data.questionTypeSelectorModel" :renderPopup="needRenderPopup" | ||
v-if="needRenderPopup" | ||
:questionTypeSelectorModel="item.data.questionTypeSelectorModel" | ||
:renderPopup="needRenderPopup" | ||
></SvComponent> | ||
</div> | ||
<SvComponent | ||
:is="'svc-add-question-type-selector'" | ||
v-if="!needRenderPopup" :questionTypeSelectorModel="item.data.questionTypeSelectorModel" :renderPopup="needRenderPopup" | ||
v-if="!needRenderPopup" | ||
:questionTypeSelectorModel="item.data.questionTypeSelectorModel" | ||
:renderPopup="needRenderPopup" | ||
></SvComponent> | ||
</template> | ||
<script lang="ts" setup> | ||
import { computed } from "vue"; | ||
import type { Action } from "survey-core"; | ||
import type {} from "survey-creator-core"; | ||
import { key2ClickDirective as vKey2click } from "survey-vue3-ui"; | ||
import { SvComponent } from "survey-vue3-ui"; | ||
import { useBase } from "survey-vue3-ui"; | ||
const props = defineProps<{ item: Action, buttonClass?: string, renderPopup?: any}>(); | ||
const props = defineProps<{ | ||
item: Action; | ||
buttonClass?: string; | ||
renderPopup?: any; | ||
}>(); | ||
useBase(() => props.item.data); | ||
const rootCss = computed(() => 'svc-element__add-new-question ' + (props.buttonClass || 'svc-btn')); | ||
const needRenderPopup = computed(() => props.renderPopup === undefined || props.renderPopup !== false); | ||
const rootCss = computed( | ||
() => "svc-element__add-new-question " + (props.buttonClass || "svc-btn") | ||
); | ||
const needRenderPopup = computed( | ||
() => props.renderPopup === undefined || props.renderPopup !== false | ||
); | ||
</script> |