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

perf(a11y): Make modals accessible #348

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
60c4595
Create base-modal component
sabicalija Nov 26, 2024
e9b913a
Update base-modal: integrate style classes from modal.css, remove mod…
sabicalija Dec 1, 2024
0450069
Create base-modal mixin for components using it
sabicalija Nov 26, 2024
bcb5a40
Remove templateModal
sabicalija Dec 1, 2024
e711e18
Update huffmanInputModal: use base-modal
sabicalija Nov 26, 2024
8154cb7
Update directionInputModal: use base-modal
sabicalija Nov 26, 2024
7ccf083
Update mouseModal: use base-modal
sabicalija Nov 26, 2024
1212099
Update scanningModal: use base-modal
sabicalija Nov 26, 2024
78f533c
Update sequentialInputModal: use base-modal
sabicalija Nov 26, 2024
a3650c0
Update unlockModal: use base-modal
sabicalija Nov 27, 2024
0894ddf
Update progressBarModal: use base-modal
sabicalija Nov 27, 2024
8611028
Update searchModal: use base-modal
sabicalija Nov 27, 2024
919a551
Update importWordsModal: use base-modal
sabicalija Nov 27, 2024
d3d1449
Update importDictionaryModal: use base-modal
sabicalija Nov 27, 2024
54bb5a9
Update gridLinkModal: use base-modal
sabicalija Nov 28, 2024
42fdc98
Update exportPdfModal: use base-modal
sabicalija Nov 28, 2024
7d9003b
Update exportModal: use base-modal
sabicalija Nov 28, 2024
88c4f94
Update importModal: use base-modal
sabicalija Dec 2, 2024
d9334d1
Update configPreviewDetail: use base-modal
sabicalija Nov 29, 2024
cf6fc59
Update editElement: use base-modal
sabicalija Nov 30, 2024
4b3d989
Update elementMoveModal: use base-modal
sabicalija Nov 30, 2024
fe229ce
Update gridDimensionModal: use base-modal
sabicalija Nov 30, 2024
86c0096
Update addMultipleModal: use base-modal
sabicalija Dec 1, 2024
5081e5e
Update gridTranslateModal: use base-modal
sabicalija Dec 1, 2024
6b35e0e
Update setNavigationModal: use base-modal
sabicalija Dec 1, 2024
4549a13
Update vuePluginManager: remove non-working update hook for v-focus
sabicalija Dec 1, 2024
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
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ <h1 class="sr-only">AsTeRICS Grid</h1>
<audio style="display: none" id="audioPlayer" src="" preload="none"></audio>
<video style="display: none" id="videoPlayer" src="" preload="none"></video>
<notification-bar ref="notificationBar"></notification-bar>
<progress-bar-modal v-show="showModal === modalTypes.MODAL_PROGRESSBAR" ref="progressBar" @close="showModal = null"></progress-bar-modal>
<search-modal v-if="showModal === modalTypes.MODAL_SEARCH" @close="showModal = null;" :route-to-edit="Router.getCurrentView() === Router.VIEWS.GridEditView" :options="modalOptions"></search-modal>
<progress-bar-modal ref="progressBar"></progress-bar-modal>
<search-modal ref="search" :route-to-edit="Router.getCurrentView() === Router.VIEWS.GridEditView" :options="modalOptions"></search-modal>
<div class="grid-container grid-mask" v-if="false">
<i class="fas fa-4x fa-spinner fa-spin" style="top: 40%;"></i>
<div style="position: fixed; top: 50%; width: 100%; text-align: center; font-size: 2em;">
Expand Down
138 changes: 0 additions & 138 deletions src/css/modal.css

This file was deleted.

13 changes: 4 additions & 9 deletions src/js/vue/mainVue.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ import { systemActionService } from '../service/systemActionService';

let MainVue = {};
let app = null;
let modalTypes = {
MODAL_SEARCH: 'MODAL_SEARCH',
MODAL_PROGRESSBAR: 'MODAL_PROGRESSBAR'
};

MainVue.setViewComponent = function (component, properties) {
if (app && app.$refs.notificationBar.tooltipOptions.closeOnNavigate) {
if (app && app.$refs.notificationBar?.tooltipOptions.closeOnNavigate) {
MainVue.clearTooltip();
}
app.setComponent(component, properties);
Expand Down Expand Up @@ -56,7 +52,7 @@ MainVue.clearTooltip = function () {
return;
}
app.hiddenPopupData = null;
app.$refs.notificationBar.clearTooltip();
app.$refs.notificationBar?.clearTooltip();
};

/**
Expand All @@ -71,7 +67,7 @@ MainVue.showProgressBar = function (percentage, options) {
if (!app) {
return;
}
app.showModal = modalTypes.MODAL_PROGRESSBAR;
app.$refs.progressBar.openModal();
app.$refs.progressBar.setProgress(percentage, options);
};

Expand All @@ -81,7 +77,7 @@ MainVue.showProgressBar = function (percentage, options) {
* @param options.searchCollectedText use text from collect element to be pre-filled in search bar, if true
*/
MainVue.showSearchModal = function (options) {
app.showModal = modalTypes.MODAL_SEARCH;
app.$refs.search.openModal();
app.modalOptions = options || {};
};

Expand All @@ -107,7 +103,6 @@ MainVue.init = function () {
Router: Router,
uiLocked: false,
hiddenPopupData: null,
modalTypes: modalTypes,
showModal: null,
modalOptions: {}
};
Expand Down
6 changes: 0 additions & 6 deletions src/js/vue/vuePluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ function initDirectives() {
if (el.focus) el.focus();
if (el.select) el.select();
}
},
updated: function (el, binding) {
if (binding.value) {
if (el.focus) el.focus();
if (el.select) el.select();
}
}
});
Vue.directive('debounce', {
Expand Down
80 changes: 56 additions & 24 deletions src/vue-components/components/editElementHeader.vue
Original file line number Diff line number Diff line change
@@ -1,43 +1,75 @@
<template>
<div class="container-fluid px-0 mb-5">
<div class="row">
<div class="col-8 col-sm-10 col-md-5 order-md-1">
<h1 name="header" class="inline">
{{ header }}
</h1>
</div>
<a v-if="openHelpFn" class="col-2 col-sm-1 col-md black order-md-3" href="javascript:;" @click="openHelpFn"><i class="fas fa-question-circle"></i></a>
<a v-if="closeFn" id="closeLink" :title="$t('close')" class="col-2 col-sm-1 col-md black order-md-4" href="javascript:;" @click="closeFn"><i class="fas fa-times"/></a>
<div class="col-12 col-md-5 d-flex align-items-center order-md-2 mt-2 mt-md-0" v-if="gridElement">
<div v-if="gridElement.type === GridElement.ELEMENT_TYPE_NORMAL">
<img class="me-1" v-if="gridElement.image && (gridElement.image.data || gridElement.image.url)" height="30" :src="gridElement.image.data || gridElement.image.url"/>
<span>{{ gridElement.label | extractTranslation }}</span>
<div v-if="gridElement" class="element">
<div v-if="gridElement.type === GridElement.ELEMENT_TYPE_NORMAL" :class="{ normal: Object.keys(gridElement.label).length > 0 }">
<img v-if="gridElement.image && (gridElement.image.data || gridElement.image.url)" :src="gridElement.image.data || gridElement.image.url"/>
<span tab-index="0">{{ gridElement.label | extractTranslation }}</span>
</div>
<div v-if="gridElement.type !== GridElement.ELEMENT_TYPE_NORMAL">
<span class="mx-2">{{ gridElement.type | translate }}</span>
<span>{{ gridElement.type | translate }}</span>
</div>
</div>
</div>
</div>
</template>

<script>

import {GridElement} from "../../js/model/GridElement.js";

export default {
props: ["header", "gridElement", "openHelpFn", "closeFn"],
props: ["gridElement"],
data() {
return {
GridElement: GridElement
}
},
methods: {
},
mounted() {
},
}
}
</script>

<style scoped>
<style lang="scss" scoped>
.element {
flex-grow: 6;
display: flex;

& > .normal {
flex-flow: column nowrap;
align-items: center;
justify-content: flex-start;
background-color: white;
border: 1px solid lightgray;
box-shadow: 0 0 0.5rem lightgray;
}

& > div {
display: flex;
padding: 0.5rem 1rem;

img {
height: 4rem;
}

img {
border: 1px solid #111;
width: 4rem;
object-fit: contain;
}

span {
padding: 0 1rem;
font-size: 1.5rem;
text-align: center;
}
}
}

@media screen and (min-width: 768px) {
.element {
& > .normal {
flex-flow: row nowrap;
}
& > div {
span {
line-height: 4rem;
height: 4rem;
}
}
}
}
</style>
64 changes: 43 additions & 21 deletions src/vue-components/components/gridSelector.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
<template>
<div class="container-fluid px-0">
<div class="row">
<div class="col-12 col-md-5">
<div class="row">
<div class="selector">
<label for="moveGrid">{{ selectLabel }}</label>
</div>
<div class="row">
<div class="col-12">
<select class="col-12" id="moveGrid" v-model="selectedGrid" @change="selectGrid(selectedGrid)" style="margin-bottom: 1em">
<div>
<select id="moveGrid" v-model="selectedGrid" @change="selectGrid(selectedGrid)" style="margin-bottom: 1em">
<option v-if="additionalSelectOptions" v-for="option in additionalSelectOptions" :value="option">{{ option | translate}}</option>
<option v-for="grid in grids" :value="grid">{{grid.label | extractTranslation}}</option>
</select>
</div>
</div>
<div class="row" v-if="selectedGrid && selectedGrid.thumbnail && selectedGrid.thumbnail.data">
<div class="col-12">
<img :src="selectedGrid.thumbnail.data" style="max-width: 100%; border: 1px solid lightgray"/>
</div>
<div v-if="selectedGrid && selectedGrid.thumbnail && selectedGrid.thumbnail.data">
<img :src="selectedGrid.thumbnail.data"/>
</div>
<div class="row" v-if="selectedGrid && selectedGrid.id">
<div class="col-12">
<button @click="prev" style="width: 49%"><i class="fas fa-arrow-left"></i> <span>{{ $t('back') }}</span></button>
<button @click="next" style="width: 49%"><span>{{ $t('next') }}</span> <i class="fas fa-arrow-right"></i></button>
</div>
<div class="controls" v-if="selectedGrid && selectedGrid.id">
<button @click="prev" :aria-label="$t('back')"><i class="fas fa-arrow-left" aria-hidden="true"></i><span>{{ $t('back') }}</span></button>
<button @click="next" :aria-label="$t('next')"><span>{{ $t('next') }}</span><i class="fas fa-arrow-right" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
</template>

<script>
Expand Down Expand Up @@ -79,5 +67,39 @@
}
</script>

<style scoped>
<style lang="scss" scoped>
.selector {
display: flex;
flex-flow: column nowrap;

.controls {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
margin-top: 1rem;
}

label {
font-weight: bold;
margin-bottom: 0.5rem;
}

select {
width: 100%;
}

button {
width: 100%;
margin-left: 1rem;

&:first-child {
margin-left: 0;
}

i + span,
span + i {
margin-left: 0.5rem;
}
}
}
</style>
Loading