@@ -330,12 +330,13 @@ export const filedrop = function (node: HTMLElement, opts?: FileDropOptions): Ac
330
330
331
331
function init ( opts : FileDropOptions ) {
332
332
options = configOptions ( node , opts ) ;
333
- console . log ( options )
333
+ console . log ( options ) ;
334
334
input = options . input ;
335
+ node . tabIndex = options . tabIndex ;
336
+
335
337
if ( ! options . disabled ) {
336
338
node . classList . remove ( "disabled" ) ;
337
339
input . multiple = options . multiple ;
338
-
339
340
if ( options . accept ?. length ) {
340
341
if ( Array . isArray ( options . accept ) ) {
341
342
input . accept = options . accept . join ( "," ) ;
@@ -347,31 +348,33 @@ export const filedrop = function (node: HTMLElement, opts?: FileDropOptions): Ac
347
348
}
348
349
349
350
input . autocomplete = "off" ;
350
- if ( options . hideInput ) {
351
- input . style . display = "none"
351
+ if ( options . hideInput ) {
352
+ input . style . display = "none" ;
352
353
}
353
- node . addEventListener ( "dragenter" , handleDragEnter ) ;
354
- node . addEventListener ( "dragleave" , handleDragLeave ) ;
355
- node . addEventListener ( "dragover" , handleDragOver ) ;
356
- node . addEventListener ( "drop" , handleDrop ) ;
357
354
358
- input . addEventListener ( "change" , handleChange ) ;
359
- input . addEventListener ( "click" , handleInputClick ) ;
355
+ if ( isBrowser ) {
356
+ node . addEventListener ( "dragenter" , handleDragEnter ) ;
357
+ node . addEventListener ( "dragleave" , handleDragLeave ) ;
358
+ node . addEventListener ( "dragover" , handleDragOver ) ;
359
+ node . addEventListener ( "drop" , handleDrop ) ;
360
360
361
- if ( options . clickToUpload ) {
362
- node . addEventListener ( "click" , handleClick ) ;
363
- } else {
364
- node . removeEventListener ( "click" , handleClick ) ;
365
- }
361
+ input . addEventListener ( "change" , handleChange ) ;
362
+ input . addEventListener ( "click" , handleInputClick ) ;
366
363
367
- if ( options . hideInput ) {
368
- node . addEventListener ( "keydown" , handleKeyDown ) ;
369
- }
370
- if ( ! options . hideInput && ! options . clickToUpload ) {
371
- node . removeEventListener ( "keydown" , handleKeyDown ) ;
372
- }
364
+ if ( options . clickToUpload ) {
365
+ node . addEventListener ( "click" , handleClick ) ;
366
+ } else {
367
+ node . removeEventListener ( "click" , handleClick ) ;
368
+ }
369
+
370
+ if ( options . hideInput ) {
371
+ node . addEventListener ( "keydown" , handleKeyDown ) ;
372
+ }
373
+
374
+ if ( ! options . hideInput && ! options . clickToUpload ) {
375
+ node . removeEventListener ( "keydown" , handleKeyDown ) ;
376
+ }
373
377
374
- if ( isBrowser ) {
375
378
window . addEventListener ( "focus" , handleWindowFocus ) ;
376
379
document . addEventListener ( "dragenter" , handleDocumentDragEnter ) ;
377
380
document . addEventListener ( "dragleave" , handleDocumentDragLeave ) ;
@@ -407,7 +410,6 @@ export const filedrop = function (node: HTMLElement, opts?: FileDropOptions): Ac
407
410
return {
408
411
update ( opts ?: FileDropOptions ) {
409
412
init ( opts || { } ) ;
410
-
411
413
} ,
412
414
destroy ( ) {
413
415
teardown ( ) ;
0 commit comments