@@ -200,8 +200,9 @@ function attachFlatpickr(node, opts, plugins = opts.noCalendar ? [] : [new yearD
200
200
onOpen : [
201
201
async function ( selectedDates , dateStr , instance ) {
202
202
if ( instance . altInput ) {
203
- instance . altInput . setAttribute ( 'readonly' , true ) ;
204
-
203
+ if ( ! opts . allowInput ) {
204
+ instance . altInput . setAttribute ( 'readonly' , true ) ;
205
+ }
205
206
const dayElement = await instance . days ;
206
207
if ( dayElement ) {
207
208
if ( dayElement . querySelector ( '.today' ) ) {
@@ -211,7 +212,9 @@ function attachFlatpickr(node, opts, plugins = opts.noCalendar ? [] : [new yearD
211
212
}
212
213
}
213
214
} else {
214
- instance . input . setAttribute ( 'readonly' , true ) ;
215
+ if ( ! opts . allowInput ) {
216
+ instance . input . setAttribute ( 'readonly' , true ) ;
217
+ }
215
218
const dayElement = await instance . days ;
216
219
if ( dayElement ) {
217
220
if ( dayElement . querySelector ( '.today' ) ) {
@@ -229,10 +232,10 @@ function attachFlatpickr(node, opts, plugins = opts.noCalendar ? [] : [new yearD
229
232
onClose : [
230
233
function ( selectedDates , dateStr , instance ) {
231
234
if ( instance . altInput ) {
232
- instance . altInput . setAttribute ( 'readonly' , false ) ;
235
+ instance . altInput . removeAttribute ( 'readonly' ) ;
233
236
instance . altInput . blur ( ) ;
234
237
} else {
235
- instance . input . setAttribute ( 'readonly' , false ) ;
238
+ instance . input . removeAttribute ( 'readonly' ) ;
236
239
instance . input . blur ( ) ;
237
240
}
238
241
} ,
0 commit comments