Skip to content

Commit 70b514f

Browse files
committed
Calendar: fix issue when double click causes router back
Fixes #2383
1 parent f9ec8c4 commit 70b514f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/core/components/calendar/calendar-class.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Calendar extends Framework7Class {
5757
function onHtmlClick(e) {
5858
const $targetEl = $(e.target);
5959
if (calendar.isPopover()) return;
60-
if (!calendar.opened) return;
60+
if (!calendar.opened || calendar.closing) return;
6161
if ($targetEl.closest('[class*="backdrop"]').length) return;
6262
if ($inputEl && $inputEl.length > 0) {
6363
if ($targetEl[0] !== $inputEl[0] && $targetEl.closest('.sheet-modal, .calendar-modal').length === 0) {
@@ -1126,7 +1126,9 @@ class Calendar extends Framework7Class {
11261126
onOpen() {
11271127
const calendar = this;
11281128
const { initialized, $el, app, $inputEl, inline, value, params } = calendar;
1129+
calendar.closing = false;
11291130
calendar.opened = true;
1131+
calendar.opening = true;
11301132

11311133
// Init main events
11321134
calendar.attachCalendarEvents();
@@ -1178,6 +1180,7 @@ class Calendar extends Framework7Class {
11781180
}
11791181
onOpened() {
11801182
const calendar = this;
1183+
calendar.opening = false;
11811184
if (calendar.$el) {
11821185
calendar.$el.trigger('calendar:opened', calendar);
11831186
}
@@ -1189,6 +1192,8 @@ class Calendar extends Framework7Class {
11891192
onClose() {
11901193
const calendar = this;
11911194
const app = calendar.app;
1195+
calendar.opening = false;
1196+
calendar.closing = true;
11921197

11931198
if (calendar.$inputEl && app.theme === 'md') {
11941199
calendar.$inputEl.trigger('blur');
@@ -1208,6 +1213,7 @@ class Calendar extends Framework7Class {
12081213
onClosed() {
12091214
const calendar = this;
12101215
calendar.opened = false;
1216+
calendar.closing = false;
12111217

12121218
if (!calendar.inline) {
12131219
Utils.nextTick(() => {

0 commit comments

Comments
 (0)