@asd20/ui 3.2.529 → 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
@@ -5,7 +5,7 @@
5
5
  "*.scss",
6
6
  "*.vue"
7
7
  ],
8
- "version": "3.2.529",
8
+ "version": "3.2.530",
9
9
  "private": false,
10
10
  "license": "MIT",
11
11
  "repository": {
@@ -21,14 +21,15 @@
21
21
  class="asd20-site-menu"
22
22
  @click="onBackgroundClick"
23
23
  @focus="onFocus"
24
+ @blur="onBlur"
24
25
  @keyup.up.stop.prevent="previous"
25
26
  @keyup.down.stop.prevent="next"
26
27
  @keyup.tab.stop.prevent="tabOrShiftTab"
27
28
  @keyup.right.stop.prevent="activateSection"
28
29
  @keyup.left.stop.prevent="deactivateSection"
29
30
  @keyup.escape="deactivateSection"
30
- @keyup.enter="activateSection"
31
31
  tabindex="-1"
32
+ v-scroll-lock="active"
32
33
  >
33
34
  <focus-trap :active="active" :initial-focus="() => $refs.focused[0]">
34
35
  <div class="asd20-site-menu__viewport">
@@ -47,7 +48,7 @@
47
48
  role="menuitem"
48
49
  ref="focused"
49
50
  aria-expanded="false"
50
- :aria-controls="`asd20-site-menu__item-${index}`"
51
+ :aria-controls="`asd20-site-menu__item-${index + 1}`"
51
52
  @click="activeSectionIndex = index"
52
53
  @mouseup="keyboardTriggeredLastAction = false"
53
54
  @keyup="keyboardTriggeredLastAction = true"
@@ -62,33 +63,41 @@
62
63
  name="slide-left"
63
64
  v-on:after-enter="afterActivateTransition"
64
65
  >
65
- <!-- <focus-trap
66
- :active="active"
67
- aria-hidden="true"
68
- returnFocusOnDeactivate="true"
69
- > -->
70
66
  <div v-if="activeSection" class="asd20-site-menu__section">
71
- <!-- <div> -->
72
- <button
67
+ <!-- <button
73
68
  class="asd20-site-menu__section__back"
74
69
  aria-expanded="true"
75
70
  aira-controls="asd20-site-menu__items"
76
71
  @click="deactivateSection"
77
72
  @mouseup="keyboardTriggeredLastAction = false"
78
73
  @keyup="keyboardTriggeredLastAction = true"
74
+ @keyup.enter="deactivateSection"
79
75
  >
80
76
  <asd20-icon name="chevron" size="sm" />
81
77
  <span class="title">{{ activeSection.title }}</span>
82
- </button>
78
+ </button> -->
83
79
 
84
80
  <div
85
81
  :id="`asd20-site-menu__item-${activeSectionIndex}`"
86
82
  class="asd20-site-menu__items"
87
83
  role="menu"
88
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>
89
98
  <a
90
99
  v-for="(item, index) in activeSection.items"
91
- :id="`asd20-site-menu__item-${activeSectionIndex}-${index}`"
100
+ :id="`asd20-site-menu__item-${activeSectionIndex}-${index + 1}`"
92
101
  :key="index"
93
102
  role="menuitem"
94
103
  class="asd20-site-menu__item"
@@ -100,8 +109,6 @@
100
109
  >
101
110
  </div>
102
111
  </div>
103
- <!-- </div> -->
104
- <!-- </focus-trap> -->
105
112
  </transition>
106
113
  </div>
107
114
  </focus-trap>
@@ -109,9 +116,14 @@
109
116
  </template>
110
117
 
111
118
  <script>
119
+ import Vue from 'vue'
120
+
112
121
  import { setTimeout } from 'timers'
113
122
  import { FocusTrap } from 'focus-trap-vue'
114
123
  import Asd20Icon from '../../atoms/Asd20Icon'
124
+ import VScrollLock from 'v-scroll-lock'
125
+ Vue.use(VScrollLock)
126
+
115
127
  export default {
116
128
  name: 'Asd20SiteMenu',
117
129
  components: { Asd20Icon, FocusTrap },
@@ -151,27 +163,49 @@ export default {
151
163
  },
152
164
  previous() {
153
165
  if (this.activeSectionIndex === -1) {
166
+ if (this.focusedSectionIndex === 0) {
167
+ this.focusedSectionIndex = this.sections.length
168
+ this.setFocusSection()
169
+ }
154
170
  if (this.focusedSectionIndex > 0) {
155
171
  this.focusedSectionIndex--
156
172
  this.setFocusSection()
157
173
  }
158
174
  } else {
159
- if (this.focusedItemIndex > 0) {
160
- this.focusedItemIndex--
175
+ if (this.focusedItemIndex === -1) {
176
+ this.setFocusItem()
177
+ } else if (this.focusedItemIndex === 0) {
178
+ this.focusedItemIndex = this.activeSection.items.length
161
179
  this.setFocusItem()
180
+ } else {
181
+ if (this.focusedItemIndex > 0) {
182
+ this.focusedItemIndex--
183
+ this.setFocusItem()
184
+ }
162
185
  }
163
186
  }
164
187
  },
165
188
  next() {
166
189
  if (this.activeSectionIndex === -1) {
190
+ if (this.focusedSectionIndex === this.sections.length - 1) {
191
+ this.focusedSectionIndex = -1
192
+ this.setFocusSection()
193
+ }
167
194
  if (this.focusedSectionIndex < this.sections.length - 1) {
168
195
  this.focusedSectionIndex++
169
196
  this.setFocusSection()
170
197
  }
171
198
  } else {
172
- if (this.focusedItemIndex < this.activeSection.items.length - 1) {
173
- this.focusedItemIndex++
199
+ if (this.focusedItemIndex === -1) {
200
+ this.setFocusItem()
201
+ } else if (this.focusedItemIndex === this.activeSection.items.length) {
202
+ this.focusedItemIndex = 0
174
203
  this.setFocusItem()
204
+ } else {
205
+ if (this.focusedItemIndex < this.activeSection.items.length) {
206
+ this.focusedItemIndex++
207
+ this.setFocusItem()
208
+ }
175
209
  }
176
210
  }
177
211
  },
@@ -182,7 +216,7 @@ export default {
182
216
  },
183
217
  afterActivateTransition() {
184
218
  this.$nextTick(() => {
185
- this.focusedItemIndex = 0
219
+ this.focusedItemIndex = 1
186
220
  if (this.keyboardTriggeredLastAction) {
187
221
  this.setFocusItem()
188
222
  }