From e88aef78b65c6c0de372f60b563e0d4d218666b3 Mon Sep 17 00:00:00 2001 From: Sam Richard Date: Tue, 31 Oct 2017 10:59:32 -0500 Subject: [PATCH] :bug: Prevent form submission when clicking calnedar buttons --- calendar/calendar.html | 4 ++-- calendar/calendar.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/calendar/calendar.html b/calendar/calendar.html index f840257..8111db9 100644 --- a/calendar/calendar.html +++ b/calendar/calendar.html @@ -21,11 +21,11 @@
- - diff --git a/calendar/calendar.js b/calendar/calendar.js index 4576242..80fa33b 100644 --- a/calendar/calendar.js +++ b/calendar/calendar.js @@ -265,6 +265,8 @@ export default { select(e) { let { target } = e; + e.preventDefault(); + if (target.classList.contains('calendar__date')) { target = target.parentNode; } @@ -358,7 +360,9 @@ export default { isToday(current) { return current.day === this.today.day && current.month === this.today.month && current.year === this.today.year; }, - navigate(dir) { + navigate(dir, e) { + e.preventDefault(); + const move = {}; if (dir === 'next') { move.month = this.current.month + 1 > 11 ? 0 : this.current.month + 1;