Skip to content

Commit

Permalink
feat(datepicker): Set isActive when calendar is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
mst101 committed Jan 17, 2022
1 parent 515b4fc commit 540cb34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/components/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
ref="datepicker"
class="vdp-datepicker"
:class="[wrapperClass, { rtl: isRtl }]"
@focusin="handleFocusChange($event)"
@focusin="handleFocusIn($event)"
@focusout="handleFocusOut($event)"
@keydown.esc="clearDate"
@keydown.tab="tabThroughNavigation($event)"
>
Expand Down
15 changes: 10 additions & 5 deletions src/mixins/navMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
delay: 0,
refs: [],
},
isActive: false,
isRevertingToOpenDate: false,
navElements: [],
navElementsFocusedIndex: 0,
Expand Down Expand Up @@ -176,15 +177,19 @@ export default {
/**
* Sets `datepickerId` (as a global) and keeps track of focusable elements
*/
handleFocusChange() {
handleFocusIn() {
document.datepickerId = this.datepickerId
this.isActive = true
this.setAllElements()
this.setNavElements()
if (this.inline) {
this.setTabbableCell()
}
},
/**
* Sets the datepicker's `isActive` state to false
*/
handleFocusOut() {
this.isActive = false
},
/**
* Returns true if the user has arrowed to a new page
Expand Down

0 comments on commit 540cb34

Please sign in to comment.