Skip to content

Commit

Permalink
Fixed #507 - Improve calendar tabbing behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Sep 28, 2020
1 parent 8f86625 commit a473897
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/components/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,9 @@ export default {
//tab
case 9: {
this.trapFocus(event);
if (!this.inline) {
this.trapFocus(event);
}
break;
}
Expand Down Expand Up @@ -1898,7 +1900,7 @@ export default {
},
trapFocus(event) {
event.preventDefault();
let focusableElements = DomHandler.getFocusableElements(this.getPicker());
let focusableElements = DomHandler.getFocusableElements(this.overlay);
if (focusableElements && focusableElements.length > 0) {
if (!document.activeElement) {
Expand Down Expand Up @@ -1987,30 +1989,20 @@ export default {
},
onKeyDown(event) {
this.isKeydown = true;
switch (event.which) {
//escape
case 27: {
if (event.keyCode === 40 && this.overlay) {
this.trapFocus(event);
}
else if (event.keyCode === 27) {
if (this.overlayVisible) {
this.overlayVisible = false;
break;
event.preventDefault();
}
//tab
case 9: {
if (this.touchUI) {
this.disableModality();
}
if (event.shiftKey) {
this.overlayVisible = false;
}
break;
}
else if (event.keyCode === 9) {
DomHandler.getFocusableElements(this.overlay).forEach(el => el.tabIndex = '-1');
if (this.overlayVisible) {
this.overlayVisible = false;
}
default:
//no op
break;
}
},
overlayRef(el) {
Expand Down

0 comments on commit a473897

Please sign in to comment.