1
1
<script lang="ts">
2
2
import {SvgIcon } from ' ../svg.ts' ;
3
3
import {GET } from ' ../modules/fetch.ts' ;
4
+ import {generateAriaId } from ' ../modules/fomantic/base.ts' ;
4
5
5
6
export default {
6
7
components: {SvgIcon },
@@ -15,6 +16,8 @@ export default {
15
16
commits: [],
16
17
hoverActivated: false ,
17
18
lastReviewCommitSha: null ,
19
+ uniqueIdMenu: generateAriaId (),
20
+ uniqueIdShowAll: generateAriaId (),
18
21
};
19
22
},
20
23
computed: {
@@ -113,12 +116,10 @@ export default {
113
116
}
114
117
// set correct tabindex to allow easier navigation
115
118
this .$nextTick (() => {
116
- const expandBtn = this .$el .querySelector (' #diff-commit-list-expand' );
117
- const showAllChanges = this .$el .querySelector (' #diff-commit-list-show-all' );
118
119
if (this .menuVisible ) {
119
- this .focusElem (showAllChanges , expandBtn );
120
+ this .focusElem (this . $refs . showAllChanges , this . $refs . expandBtn );
120
121
} else {
121
- this .focusElem (expandBtn , showAllChanges );
122
+ this .focusElem (this . $refs . expandBtn , this . $refs . showAllChanges );
122
123
}
123
124
});
124
125
},
@@ -189,23 +190,23 @@ export default {
189
190
};
190
191
</script >
191
192
<template >
192
- <div class =" ui scrolling dropdown custom" >
193
+ <div class =" ui scrolling dropdown custom diff-commit-selector " >
193
194
<button
195
+ ref =" expandBtn"
194
196
class =" ui basic button"
195
- id =" diff-commit-list-expand"
196
197
@click.stop =" toggleMenu()"
197
198
:data-tooltip-content =" locale.filter_changes_by_commit"
198
199
aria-haspopup =" true"
199
- aria-controls =" diff-commit-selector-menu"
200
200
:aria-label =" locale.filter_changes_by_commit"
201
- aria-activedescendant =" diff-commit-list-show-all"
201
+ :aria-controls =" uniqueIdMenu"
202
+ :aria-activedescendant =" uniqueIdShowAll"
202
203
>
203
204
<svg-icon name =" octicon-git-commit" />
204
205
</button >
205
206
<!-- this dropdown is not managed by Fomantic UI, so it needs some classes like "transition" explicitly -->
206
- <div class =" left menu transition" id =" diff-commit-selector-menu " :class =" {visible: menuVisible}" v-show =" menuVisible" v-cloak :aria-expanded =" menuVisible ? 'true': 'false'" >
207
+ <div class =" left menu transition" : id =" uniqueIdMenu " :class =" {visible: menuVisible}" v-show =" menuVisible" v-cloak :aria-expanded =" menuVisible ? 'true': 'false'" >
207
208
<div class =" loading-indicator is-loading" v-if =" isLoading" />
208
- <div v-if =" !isLoading" class =" vertical item" id =" diff-commit-list-show-all " role =" menuitem" @keydown.enter =" showAllChanges()" @click =" showAllChanges()" >
209
+ <div v-if =" !isLoading" class =" item" : id =" uniqueIdShowAll " ref = " showAllChanges " role =" menuitem" @keydown.enter =" showAllChanges()" @click =" showAllChanges()" >
209
210
<div class =" gt-ellipsis" >
210
211
{{ locale.show_all_commits }}
211
212
</div >
@@ -216,7 +217,7 @@ export default {
216
217
<!-- only show the show changes since last review if there is a review AND we are commits ahead of the last review -->
217
218
<div
218
219
v-if =" lastReviewCommitSha != null" role =" menuitem"
219
- class =" vertical item"
220
+ class =" item"
220
221
:class =" {disabled: !commitsSinceLastReview}"
221
222
@keydown.enter =" changesSinceLastReviewClick()"
222
223
@click =" changesSinceLastReviewClick()"
@@ -231,8 +232,8 @@ export default {
231
232
<span v-if =" !isLoading" class =" info text light-2" >{{ locale.select_commit_hold_shift_for_range }}</span >
232
233
<template v-for =" commit in commits " :key =" commit .id " >
233
234
<div
234
- class =" vertical item" role =" menuitem"
235
- :class =" {selection : commit.selected, hovered: commit.hovered }"
235
+ class =" item" role =" menuitem"
236
+ :class =" {active : commit.selected}"
236
237
@keydown.enter.exact =" commitClicked(commit.id)"
237
238
@keydown.enter.shift.exact =" commitClickedShift(commit)"
238
239
@mouseover.shift =" highlight(commit)"
@@ -262,46 +263,37 @@ export default {
262
263
</div >
263
264
</template >
264
265
<style scoped>
265
- .hovered :not (.selection ) {
266
- background-color : var (--color-small-accent ) !important ;
267
- }
268
- .selection {
269
- background-color : var (--color-accent ) !important ;
270
- }
271
-
272
- .info {
273
- display : inline-block ;
274
- padding : 7px 14px !important ;
275
- line-height : 1.4 ;
276
- width : 100% ;
277
- }
278
-
279
- #diff-commit-selector-menu {
266
+ .ui.dropdown.diff-commit-selector .menu {
267
+ margin-top : 0.25em ;
280
268
overflow-x : hidden ;
281
269
max-height : 450px ;
282
270
}
283
271
284
- # diff-commit-selector- menu .loading-indicator {
272
+ .ui.dropdown. diff-commit-selector . menu .loading-indicator {
285
273
height : 200px ;
286
274
width : 350px ;
287
275
}
288
276
289
- # diff-commit-selector- menu .item ,
290
- # diff-commit-selector- menu .info {
291
- display : flex !important ;
277
+ .ui.dropdown. diff-commit-selector . menu > .item ,
278
+ .ui.dropdown. diff-commit-selector . menu > .info {
279
+ display : flex ;
292
280
flex-direction : row ;
293
281
line-height : 1.4 ;
282
+ gap : 0.25em ;
294
283
padding : 7px 14px !important ;
284
+ }
285
+
286
+ .ui.dropdown.diff-commit-selector .menu > .item :not (:first-child ),
287
+ .ui.dropdown.diff-commit-selector .menu > .info :not (:first-child ) {
295
288
border-top : 1px solid var (--color-secondary ) !important ;
296
- gap : 0.25em ;
297
289
}
298
290
299
- # diff-commit-selector- menu .item :focus {
291
+ .ui.dropdown. diff-commit-selector . menu > .item :focus {
300
292
color : var (--color-text );
301
293
background : var (--color-hover );
302
294
}
303
295
304
- # diff-commit-selector- menu .commit-list-summary {
296
+ .ui.dropdown. diff-commit-selector . menu .commit-list-summary {
305
297
max-width : min (380px , 96vw );
306
298
}
307
299
</style >
0 commit comments