Skip to content

Commit

Permalink
fix(focus): remove problematic focus tracking #93
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-capsule42 committed Jan 4, 2023
1 parent e395b97 commit a7b1c5a
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/auro-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,6 @@ class AuroDatePicker extends LitElement {
return [styleCss];
}

/**
* @private
* @returns {void} Hides bib when the dropdown or it's contents lose focus.
*/
assessFocusWithin() {
setTimeout(() => {
if (this.contains(document.activeElement)) {
this.trackFocus();
} else if (this.contains(this.focusElem) && document.activeElement === document.querySelector('body')) {
this.input.focus();
}
}, 100); /* eslint-disable-line no-magic-numbers */
}

/**
* @private
* @returns {void} Determines if dropdown bib should be closed on focus change.
*/
trackFocus() {
this.focusElem = document.activeElement;

this.focusElem.addEventListener('blur', () => {
this.assessFocusWithin();
});
}

/**
* Focuses the combobox trigger input.
* @returns {void}
Expand Down Expand Up @@ -485,13 +459,6 @@ class AuroDatePicker extends LitElement {
this.configureInput();
this.configureCalendar();

// start focus tracking the first time we interact with the datepicker
this.addEventListener('focusin', () => {
if (!this.focusElem) {
this.trackFocus();
}
});

// Close the datepicker when clicking outside it
document.addEventListener('click', (evt) => {
if (!evt.composedPath().includes(this)) {
Expand Down

0 comments on commit a7b1c5a

Please sign in to comment.