Skip to content

Commit 69ac213

Browse files
committed
fix(Calendar): add the proper navigation button type to prevent unintended form submission
1 parent 96e3b73 commit 69ac213

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

js/src/calendar.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,26 +564,26 @@ class Calendar extends BaseComponent {
564564
navigationElement.classList.add('calendar-nav')
565565
navigationElement.innerHTML = `
566566
<div class="calendar-nav-prev">
567-
<button class="calendar-nav-btn btn-double-prev" aria-label="${this._config.ariaNavPrevYearLabel}">
567+
<button type="button" class="calendar-nav-btn btn-double-prev" aria-label="${this._config.ariaNavPrevYearLabel}">
568568
<span class="calendar-nav-icon calendar-nav-icon-double-prev"></span>
569569
</button>
570-
${this._view === 'days' ? `<button class="calendar-nav-btn btn-prev" aria-label="${this._config.ariaNavPrevMonthLabel}">
570+
${this._view === 'days' ? `<button type="button" class="calendar-nav-btn btn-prev" aria-label="${this._config.ariaNavPrevMonthLabel}">
571571
<span class="calendar-nav-icon calendar-nav-icon-prev"></span>
572572
</button>` : ''}
573573
</div>
574574
<div class="calendar-nav-date" aria-live="polite">
575-
${this._view === 'days' ? `<button class="calendar-nav-btn btn-sm btn-month">
575+
${this._view === 'days' ? `<button type="button" class="calendar-nav-btn btn-sm btn-month">
576576
${calendarDate.toLocaleDateString(this._config.locale, { month: 'long' })}
577577
</button>` : ''}
578-
<button class="calendar-nav-btn btn-year">
578+
<button type="button" class="calendar-nav-btn btn-year">
579579
${calendarDate.toLocaleDateString(this._config.locale, { year: 'numeric' })}
580580
</button>
581581
</div>
582582
<div class="calendar-nav-next">
583-
${this._view === 'days' ? `<button class="calendar-nav-btn btn-next" aria-label="${this._config.ariaNavNextMonthLabel}">
583+
${this._view === 'days' ? `<button type="button" class="calendar-nav-btn btn-next" aria-label="${this._config.ariaNavNextMonthLabel}">
584584
<span class="calendar-nav-icon calendar-nav-icon-next"></span>
585585
</button>` : ''}
586-
<button class="calendar-nav-btn btn-double-next" aria-label="${this._config.ariaNavNextYearLabel}">
586+
<button type="button" class="calendar-nav-btn btn-double-next" aria-label="${this._config.ariaNavNextYearLabel}">
587587
<span class="calendar-nav-icon calendar-nav-icon-double-next"></span>
588588
</button>
589589
</div>

0 commit comments

Comments
 (0)