File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 64
64
<slot name =" beforeCalendarHeader" />
65
65
<Component
66
66
:is =" picker"
67
+ ref =" picker"
67
68
:bootstrap-styling =" bootstrapStyling"
68
69
class =" picker-view"
69
70
:day-cell-content =" dayCellContent"
@@ -112,6 +113,7 @@ import DateInput from '~/components/DateInput.vue'
112
113
import DisabledDate from ' ~/utils/DisabledDate'
113
114
import inputProps from ' ~/mixins/inputProps.vue'
114
115
import makeDateUtils from ' ~/utils/DateUtils'
116
+ import navMixin from ' ~/mixins/navMixin.vue'
115
117
import PickerDay from ' ~/components/PickerDay.vue'
116
118
import PickerMonth from ' ~/components/PickerMonth.vue'
117
119
import PickerYear from ' ~/components/PickerYear.vue'
@@ -126,7 +128,7 @@ export default {
126
128
PickerYear,
127
129
Popup,
128
130
},
129
- mixins: [inputProps],
131
+ mixins: [inputProps, navMixin ],
130
132
props: {
131
133
appendToBody: {
132
134
type: Boolean ,
@@ -438,6 +440,10 @@ export default {
438
440
}
439
441
440
442
this .setInitialView ()
443
+ this .$nextTick (() => {
444
+ this .setTabbableCell ()
445
+ })
446
+
441
447
this .$emit (' opened' )
442
448
},
443
449
/**
Original file line number Diff line number Diff line change
1
+ <script >
2
+ export default {
3
+ data () {
4
+ return {
5
+ tabbableCell: null ,
6
+ }
7
+ },
8
+ methods: {
9
+ /**
10
+ * Sets the focus-trapped cell in the picker
11
+ */
12
+ // eslint-disable-next-line complexity
13
+ setTabbableCell () {
14
+ if (! this .$refs .picker || ! this .$refs .picker .$refs .cells ) {
15
+ return
16
+ }
17
+
18
+ const pickerCells = this .$refs .picker .$refs .cells .$el
19
+
20
+ this .tabbableCell =
21
+ pickerCells .querySelector (' button.selected:not(.muted):enabled' ) ||
22
+ pickerCells .querySelector (' button.open:not(.muted):enabled' ) ||
23
+ pickerCells .querySelector (' button.today:not(.muted):enabled' ) ||
24
+ pickerCells .querySelector (' button.cell:not(.muted):enabled' )
25
+ },
26
+ },
27
+ }
28
+ </script >
You can’t perform that action at this time.
0 commit comments