@asd20/ui 3.2.528 → 3.2.530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,13 +20,16 @@
|
|
|
20
20
|
ref="menuContainer"
|
|
21
21
|
class="asd20-site-menu"
|
|
22
22
|
@click="onBackgroundClick"
|
|
23
|
+
@focus="onFocus"
|
|
24
|
+
@blur="onBlur"
|
|
23
25
|
@keyup.up.stop.prevent="previous"
|
|
24
26
|
@keyup.down.stop.prevent="next"
|
|
27
|
+
@keyup.tab.stop.prevent="tabOrShiftTab"
|
|
25
28
|
@keyup.right.stop.prevent="activateSection"
|
|
26
29
|
@keyup.left.stop.prevent="deactivateSection"
|
|
27
30
|
@keyup.escape="deactivateSection"
|
|
28
|
-
@keyup.enter="activateSection"
|
|
29
31
|
tabindex="-1"
|
|
32
|
+
v-scroll-lock="active"
|
|
30
33
|
>
|
|
31
34
|
<focus-trap :active="active" :initial-focus="() => $refs.focused[0]">
|
|
32
35
|
<div class="asd20-site-menu__viewport">
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
role="menuitem"
|
|
46
49
|
ref="focused"
|
|
47
50
|
aria-expanded="false"
|
|
48
|
-
:aria-controls="`asd20-site-menu__item-${index}`"
|
|
51
|
+
:aria-controls="`asd20-site-menu__item-${index + 1}`"
|
|
49
52
|
@click="activeSectionIndex = index"
|
|
50
53
|
@mouseup="keyboardTriggeredLastAction = false"
|
|
51
54
|
@keyup="keyboardTriggeredLastAction = true"
|
|
@@ -60,33 +63,41 @@
|
|
|
60
63
|
name="slide-left"
|
|
61
64
|
v-on:after-enter="afterActivateTransition"
|
|
62
65
|
>
|
|
63
|
-
<!-- <focus-trap
|
|
64
|
-
:active="active"
|
|
65
|
-
aria-hidden="true"
|
|
66
|
-
returnFocusOnDeactivate="true"
|
|
67
|
-
> -->
|
|
68
66
|
<div v-if="activeSection" class="asd20-site-menu__section">
|
|
69
|
-
<!-- <
|
|
70
|
-
<button
|
|
67
|
+
<!-- <button
|
|
71
68
|
class="asd20-site-menu__section__back"
|
|
72
69
|
aria-expanded="true"
|
|
73
70
|
aira-controls="asd20-site-menu__items"
|
|
74
71
|
@click="deactivateSection"
|
|
75
72
|
@mouseup="keyboardTriggeredLastAction = false"
|
|
76
73
|
@keyup="keyboardTriggeredLastAction = true"
|
|
74
|
+
@keyup.enter="deactivateSection"
|
|
77
75
|
>
|
|
78
76
|
<asd20-icon name="chevron" size="sm" />
|
|
79
77
|
<span class="title">{{ activeSection.title }}</span>
|
|
80
|
-
</button>
|
|
78
|
+
</button> -->
|
|
81
79
|
|
|
82
80
|
<div
|
|
83
81
|
:id="`asd20-site-menu__item-${activeSectionIndex}`"
|
|
84
82
|
class="asd20-site-menu__items"
|
|
85
83
|
role="menu"
|
|
86
84
|
>
|
|
85
|
+
<button
|
|
86
|
+
:id="`asd20-site-menu__item-${activeSectionIndex}-0`"
|
|
87
|
+
class="asd20-site-menu__section__back"
|
|
88
|
+
aria-expanded="true"
|
|
89
|
+
aira-controls="asd20-site-menu__items"
|
|
90
|
+
@click="deactivateSection"
|
|
91
|
+
@mouseup="keyboardTriggeredLastAction = false"
|
|
92
|
+
@keyup="keyboardTriggeredLastAction = true"
|
|
93
|
+
@keyup.enter="deactivateSection"
|
|
94
|
+
>
|
|
95
|
+
<asd20-icon name="chevron" size="sm" />
|
|
96
|
+
<span class="title">{{ activeSection.title }}</span>
|
|
97
|
+
</button>
|
|
87
98
|
<a
|
|
88
99
|
v-for="(item, index) in activeSection.items"
|
|
89
|
-
:id="`asd20-site-menu__item-${activeSectionIndex}-${index}`"
|
|
100
|
+
:id="`asd20-site-menu__item-${activeSectionIndex}-${index + 1}`"
|
|
90
101
|
:key="index"
|
|
91
102
|
role="menuitem"
|
|
92
103
|
class="asd20-site-menu__item"
|
|
@@ -98,8 +109,6 @@
|
|
|
98
109
|
>
|
|
99
110
|
</div>
|
|
100
111
|
</div>
|
|
101
|
-
<!-- </div> -->
|
|
102
|
-
<!-- </focus-trap> -->
|
|
103
112
|
</transition>
|
|
104
113
|
</div>
|
|
105
114
|
</focus-trap>
|
|
@@ -107,9 +116,14 @@
|
|
|
107
116
|
</template>
|
|
108
117
|
|
|
109
118
|
<script>
|
|
119
|
+
import Vue from 'vue'
|
|
120
|
+
|
|
110
121
|
import { setTimeout } from 'timers'
|
|
111
122
|
import { FocusTrap } from 'focus-trap-vue'
|
|
112
123
|
import Asd20Icon from '../../atoms/Asd20Icon'
|
|
124
|
+
import VScrollLock from 'v-scroll-lock'
|
|
125
|
+
Vue.use(VScrollLock)
|
|
126
|
+
|
|
113
127
|
export default {
|
|
114
128
|
name: 'Asd20SiteMenu',
|
|
115
129
|
components: { Asd20Icon, FocusTrap },
|
|
@@ -149,27 +163,49 @@ export default {
|
|
|
149
163
|
},
|
|
150
164
|
previous() {
|
|
151
165
|
if (this.activeSectionIndex === -1) {
|
|
166
|
+
if (this.focusedSectionIndex === 0) {
|
|
167
|
+
this.focusedSectionIndex = this.sections.length
|
|
168
|
+
this.setFocusSection()
|
|
169
|
+
}
|
|
152
170
|
if (this.focusedSectionIndex > 0) {
|
|
153
171
|
this.focusedSectionIndex--
|
|
154
172
|
this.setFocusSection()
|
|
155
173
|
}
|
|
156
174
|
} else {
|
|
157
|
-
if (this.focusedItemIndex
|
|
158
|
-
this.
|
|
175
|
+
if (this.focusedItemIndex === -1) {
|
|
176
|
+
this.setFocusItem()
|
|
177
|
+
} else if (this.focusedItemIndex === 0) {
|
|
178
|
+
this.focusedItemIndex = this.activeSection.items.length
|
|
159
179
|
this.setFocusItem()
|
|
180
|
+
} else {
|
|
181
|
+
if (this.focusedItemIndex > 0) {
|
|
182
|
+
this.focusedItemIndex--
|
|
183
|
+
this.setFocusItem()
|
|
184
|
+
}
|
|
160
185
|
}
|
|
161
186
|
}
|
|
162
187
|
},
|
|
163
188
|
next() {
|
|
164
189
|
if (this.activeSectionIndex === -1) {
|
|
190
|
+
if (this.focusedSectionIndex === this.sections.length - 1) {
|
|
191
|
+
this.focusedSectionIndex = -1
|
|
192
|
+
this.setFocusSection()
|
|
193
|
+
}
|
|
165
194
|
if (this.focusedSectionIndex < this.sections.length - 1) {
|
|
166
195
|
this.focusedSectionIndex++
|
|
167
196
|
this.setFocusSection()
|
|
168
197
|
}
|
|
169
198
|
} else {
|
|
170
|
-
if (this.focusedItemIndex
|
|
171
|
-
this.focusedItemIndex++
|
|
199
|
+
if (this.focusedItemIndex === -1) {
|
|
172
200
|
this.setFocusItem()
|
|
201
|
+
} else if (this.focusedItemIndex === this.activeSection.items.length) {
|
|
202
|
+
this.focusedItemIndex = 0
|
|
203
|
+
this.setFocusItem()
|
|
204
|
+
} else {
|
|
205
|
+
if (this.focusedItemIndex < this.activeSection.items.length) {
|
|
206
|
+
this.focusedItemIndex++
|
|
207
|
+
this.setFocusItem()
|
|
208
|
+
}
|
|
173
209
|
}
|
|
174
210
|
}
|
|
175
211
|
},
|
|
@@ -180,7 +216,7 @@ export default {
|
|
|
180
216
|
},
|
|
181
217
|
afterActivateTransition() {
|
|
182
218
|
this.$nextTick(() => {
|
|
183
|
-
this.focusedItemIndex =
|
|
219
|
+
this.focusedItemIndex = 1
|
|
184
220
|
if (this.keyboardTriggeredLastAction) {
|
|
185
221
|
this.setFocusItem()
|
|
186
222
|
}
|
|
@@ -235,6 +271,19 @@ export default {
|
|
|
235
271
|
this.$refs.focused[0].focus()
|
|
236
272
|
})
|
|
237
273
|
},
|
|
274
|
+
tabOrShiftTab(event) {
|
|
275
|
+
if (event.shiftKey) {
|
|
276
|
+
this.shiftKeyPressed()
|
|
277
|
+
} else {
|
|
278
|
+
this.shiftKeyNotPressed()
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
shiftKeyPressed() {
|
|
282
|
+
this.previous()
|
|
283
|
+
},
|
|
284
|
+
shiftKeyNotPressed() {
|
|
285
|
+
this.next()
|
|
286
|
+
},
|
|
238
287
|
},
|
|
239
288
|
}
|
|
240
289
|
</script>
|