Skip to content

Commit 31b5b45

Browse files
authored
Merge pull request #783 from citation-file-format/670-tab
2 parents c5ac62f + 9f257d9 commit 31b5b45

4 files changed

Lines changed: 40 additions & 17 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
with:
2929
start: npm run dev
3030
wait-on: 'http://localhost:8080/cff-initializer-javascript/#'
31+
- name: Upload Screenshot of Cypress when errors occur
32+
if: failure()
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: cypress-screenshots
36+
path: cypress/screenshots
3137
- name: Code coverage
3238
uses: codecov/codecov-action@v3
3339
with:

src/components/IdentifierCardEditing.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
>
77
<q-card-section class="q-gutter-md">
88
<fieldset
9+
id="radiogroup"
910
role="radiogroup"
11+
tabindex="0"
1012
>
1113
<legend>
1214
What type of identifier?
13-
<!-- <InfoDialog name="type" /> -->
1415
</legend>
1516
<label
1617
v-for="typeOption in typeOptions"
@@ -27,7 +28,6 @@
2728
</fieldset>
2829

2930
<q-input
30-
autofocus
3131
data-cy="input-value"
3232
dense
3333
outlined

src/components/LayoutStepper.vue

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55
id="header"
66
class="text-black"
77
>
8-
<a
9-
class="skip-to-main-content-link"
10-
href="#main"
8+
<div
119
id="skipToMain"
12-
v-on:blur="skipToMainFocused = false"
13-
v-on:click.prevent="focusMain"
14-
v-on:focus="skipToMainFocused = true"
1510
>
16-
Skip to main content
17-
</a>
11+
<a
12+
v-for="skipLink in skipLinks"
13+
class="skip-to-main-content-link"
14+
v-bind:key="skipLink.id"
15+
v-bind:href="`#${skipLink.id}`"
16+
v-on:blur="skipToMainFocused = false"
17+
v-on:click.prevent="focusElement(skipLink.id)"
18+
v-on:focus="skipToMainFocused = true"
19+
>
20+
Skip to {{ skipLink.where }}
21+
</a>
22+
</div>
1823
<Header
1924
v-bind:show-open-preview-button="isPreviewDrawer"
2025
/>
@@ -24,20 +29,24 @@
2429
<q-page
2530
id="main"
2631
role="main"
27-
tabindex="0"
2832
v-bind:class="isMainConnected ? '' : 'q-pa-md'"
2933
>
3034
<div v-bind:class="['row', 'justify-center', isMainConnected ? '' : 'q-pa-md q-ml-auto']">
3135
<div
3236
id="main-block"
3337
v-bind:class="['row', 'col', 'bg-white', 'q-pa-md', isMainConnected ? '' : 'elevated rounded-borders q-mx-lg']"
3438
>
35-
<aside class="col-auto gt-xs">
39+
<aside
40+
class="col-auto gt-xs"
41+
id="stepper"
42+
tabindex="0"
43+
>
3644
<Stepper />
3745
</aside>
38-
<div
39-
id="form"
46+
<form
4047
class="col column"
48+
id="form"
49+
tabindex="0"
4150
>
4251
<div id="form-content">
4352
<router-view />
@@ -60,7 +69,7 @@
6069
no-caps
6170
v-on:click="togglePreview"
6271
/>
63-
</div>
72+
</form>
6473
</div>
6574
<component
6675
v-if="!isOnlyForm"
@@ -136,8 +145,8 @@ export default defineComponent({
136145
isPreviewDrawerOpen.value = false
137146
}
138147
return {
139-
focusMain: () => {
140-
const element = window.document.getElementById('main')
148+
focusElement: (id: string) => {
149+
const element = window.document.getElementById(id)
141150
if (!element) return
142151
element.focus()
143152
},
@@ -149,6 +158,10 @@ export default defineComponent({
149158
isPreviewDrawerOpen,
150159
isPreviewDrawer: computed(() => q.screen.sm || q.screen.md),
151160
isMainConnected: computed(() => q.screen.xs || q.screen.sm),
161+
skipLinks: [
162+
{ id: 'form', where: 'main content' },
163+
{ id: 'stepper', where: 'stepper navigation' }
164+
],
152165
skipToMainFocused: ref(false),
153166
onResize,
154167
togglePreview: () => {

src/components/ScreenIdentifiers.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export default defineComponent({
9494
editingId.value = newIdentifiers.length - 1
9595
// await the DOM update that resulted from updating the identifiers list
9696
await nextTick()
97+
const radio = document.getElementById('radiogroup')
98+
if (radio) {
99+
radio.focus()
100+
}
97101
scrollToBottom()
98102
}
99103
const removeIdentifier = (index: number) => {

0 commit comments

Comments
 (0)