Skip to content

Commit fc17a15

Browse files
committed
fix(datepicker): Only focus-trap buttons in PickerHeader()
1 parent 0094f30 commit fc17a15

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/mixins/navMixin.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,17 @@ export default {
209209
return this.getFocusableElements(picker.children[index])
210210
},
211211
/**
212-
* Returns an array of all HTML elements which should be focus-trapped in the header
213-
* @returns {Array} An array of HTML elements
212+
* Returns an array of all HTMLButtonElements which should be focus-trapped in the header
213+
* @returns {Array} An array of HTMLButtonElements
214214
*/
215215
getElementsFromHeader() {
216-
const view = this.ucFirst(this.view)
217-
const beforeCalendarSlotName = `beforeCalendarHeader${view}`
218-
const picker = this.$refs.picker.$el
219-
const index = this.hasSlot(beforeCalendarSlotName) ? 1 : 0
220-
const fragment = picker.children[index]
216+
if (!this.$refs.picker.$refs.pickerHeader) {
217+
return []
218+
}
219+
const header = this.$refs.picker.$refs.pickerHeader.$el
220+
const navNodeList = header.querySelectorAll('button:enabled')
221221
222-
return this.showHeader ? this.getFocusableElements(fragment) : []
222+
return [...Array.prototype.slice.call(navNodeList)]
223223
},
224224
/**
225225
* Returns an array of focusable elements in a given HTML fragment

0 commit comments

Comments
 (0)