@@ -35,9 +35,13 @@ const DROPDOWN_TPL = `
3535 <div class="calendar-month-selector">
3636 <button class="calendar-btn bx bx-chevron-left" data-calendar-toggle="previous"></button>
3737
38- <select data-calendar-input="month">
39- ${ Object . entries ( MONTHS ) . map ( ( [ i , month ] ) => `<option value=${ i } >${ month } </option>` ) }
40- </select>
38+ <button class="btn dropdown-toggle" type="button"
39+ data-bs-toggle="dropdown" data-bs-auto-close="true"
40+ aria-expanded="false"
41+ data-calendar-input="month"></button>
42+ <ul class="dropdown-menu" data-calendar-input="month-list">
43+ ${ Object . entries ( MONTHS ) . map ( ( [ i , month ] ) => `<li><button class="dropdown-item" data-value=${ i } >${ month } </button></li>` ) . join ( "" ) }
44+ </ul>
4145
4246 <button class="calendar-btn bx bx-chevron-right" data-calendar-toggle="next"></button>
4347 </div>
@@ -82,9 +86,11 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
8286
8387 // Month navigation
8488 this . $monthSelect = this . $dropdownContent . find ( '[data-calendar-input="month"]' ) ;
85- this . $monthSelect . on ( "input" , ( e ) => {
86- this . date . setMonth ( e . target . value ) ;
89+ this . monthDropdown = bootstrap . Dropdown . getOrCreateInstance ( this . $monthSelect ) ;
90+ this . $dropdownContent . find ( '[data-calendar-input="month-list"] button' ) . on ( "click" , ( e ) => {
91+ this . date . setMonth ( e . target . dataset . value ) ;
8792 this . createMonth ( ) ;
93+ this . monthDropdown . hide ( ) ;
8894 } ) ;
8995 this . $next = this . $dropdownContent . find ( '[data-calendar-toggle="next"]' ) ;
9096 this . $next . on ( 'click' , ( ) => {
@@ -234,7 +240,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
234240 this . date . setDate ( 1 ) ;
235241 this . date . setMonth ( this . date . getMonth ( ) - 1 ) ;
236242
237- this . $monthSelect . val ( this . date . getMonth ( ) ) ;
243+ this . $monthSelect . text ( MONTHS [ this . date . getMonth ( ) ] ) ;
238244 this . $yearSelect . val ( this . date . getFullYear ( ) ) ;
239245 }
240246
0 commit comments