Skip to content

Commit

Permalink
fix inline datepicker - custom container (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
iprzybysz committed Jun 30, 2023
1 parent abb1f87 commit 5cea098
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/forms/datepicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,10 @@ class Datepicker {

_closeDropdown() {
const datepicker = SelectorEngine.findOne(DROPDOWN_CONTAINER_SELECTOR);
const container = this._getContainer();
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
if (datepicker) {
document.body.removeChild(datepicker);
container.removeChild(datepicker);
}

if (this._popper) {
Expand All @@ -1124,7 +1125,7 @@ class Datepicker {
}
datepicker.addEventListener("animationend", () => {
if (datepicker) {
document.body.removeChild(datepicker);
container.removeChild(datepicker);
}

if (this._popper) {
Expand Down

0 comments on commit 5cea098

Please sign in to comment.