This repository was archived by the owner on Sep 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/components/duet-date-picker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,9 +155,10 @@ Sets focus on the date picker's input. Use this method instead of the global `fo
155155
156156Type: ` Promise<void> `
157157
158- ### ` show() => Promise<void> `
158+ ### ` show(moveFocusToCalendar?: boolean ) => Promise<void> `
159159
160- Show the calendar modal, moving focus to the calendar inside.
160+ Show the calendar modal. Set ` moveFocusToCalendar ` to false to prevent
161+ the focus from moving to the calendar. Default is true.
161162
162163#### Returns
163164
Original file line number Diff line number Diff line change @@ -311,17 +311,20 @@ export class DuetDatePicker implements ComponentInterface {
311311 }
312312
313313 /**
314- * Show the calendar modal, moving focus to the calendar inside.
314+ * Show the calendar modal. Set `moveFocusToCalendar` to false to prevent
315+ * the focus from moving to the calendar. Default is true.
315316 */
316- @Method ( ) async show ( ) {
317+ @Method ( ) async show ( moveFocusToCalendar = true ) {
317318 this . open = true
318319 this . duetOpen . emit ( {
319320 component : "duet-date-picker" ,
320321 } )
321- this . setFocusedDay ( parseISODate ( this . value ) || new Date ( ) )
322322
323- clearTimeout ( this . focusTimeoutId )
324- this . focusTimeoutId = setTimeout ( ( ) => this . monthSelectNode . focus ( ) , TRANSITION_MS )
323+ this . setFocusedDay ( parseISODate ( this . value ) || new Date ( ) )
324+ if ( moveFocusToCalendar ) {
325+ clearTimeout ( this . focusTimeoutId )
326+ this . focusTimeoutId = setTimeout ( ( ) => this . monthSelectNode . focus ( ) , TRANSITION_MS )
327+ }
325328 }
326329
327330 /**
Original file line number Diff line number Diff line change @@ -58,9 +58,10 @@ Type: `Promise<void>`
5858
5959
6060
61- ### ` show() => Promise<void> `
61+ ### ` show(moveFocusToCalendar?: boolean ) => Promise<void> `
6262
63- Show the calendar modal, moving focus to the calendar inside.
63+ Show the calendar modal. Set ` moveFocusToCalendar ` to false to prevent
64+ the focus from moving to the calendar. Default is true.
6465
6566#### Returns
6667
You can’t perform that action at this time.
0 commit comments