Skip to content

Commit

Permalink
Merge branch 'master' into ROU-3947
Browse files Browse the repository at this point in the history
  • Loading branch information
BenOsodrac authored Jan 12, 2024
2 parents b9d979f + 3187879 commit 6bea76d
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,8 @@ function FlatpickrInstance(
bind(window.document, "focus", documentClick, { capture: true });

if (self.config.clickOpens === true) {
// To provide a better experience for the use of assistive technologies in mobile devices,
// Let's bind the handler to the focus event instead of click event.
if (
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
bind(self._input, "focus", self.open);
} else {
bind(self._input, "click", self.open);
}
bind(self._input, "focus", self.open);
bind(self._input, "click", self.open);
}

if (self.daysContainer !== undefined) {
Expand Down Expand Up @@ -2034,6 +2025,10 @@ function FlatpickrInstance(
e?: FocusEvent | MouseEvent,
positionElement = self._positionElement
) {
if (self.input.disabled || self._input.disabled) {
return;
}

if (self.isMobile === true) {
if (e) {
e.preventDefault();
Expand All @@ -2050,7 +2045,7 @@ function FlatpickrInstance(

triggerEvent("onOpen");
return;
} else if (self._input.disabled || self.config.inline) {
} else if (self.config.inline) {
return;
}

Expand Down

0 comments on commit 6bea76d

Please sign in to comment.