nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Input with type file not working on first attempt

Open ybwai opened this issue 1 year ago • 8 comments

NextUI Version

2.2.9

Describe the bug

Adding an Input component with type file requires you to select the file twice before it sets it as value.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Latest NextJS with App Router (fresh install)
  2. Add a <Input type="file" name="file" /> to any page
  3. Select a file, you will see the value does not update and it sill says No file chosen
  4. Select a file again, now it updates and sets the file

Expected behavior

Should set the file on first attempt

Screenshots or Videos

Screen Recording 2024-02-21 at 23 46 27

Operating System Version

MacOS

Browser

Chrome

ybwai avatar Feb 21 '24 23:02 ybwai

Any update on this bug?

ubr0n avatar Mar 10 '24 20:03 ubr0n

Same exact bug for me. Works fine if I just use a plain <input> but does not work using the Input component.

andyryan33 avatar Mar 12 '24 04:03 andyryan33

Already same issue opened here #2311

m-naeem66622 avatar Mar 15 '24 13:03 m-naeem66622

I'm having the same problem too

mstfblci avatar Mar 24 '24 10:03 mstfblci

hey did anyone find the solution?

NAMANIND avatar Mar 27 '24 14:03 NAMANIND

i just handle it like this and it worked:

	const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
		e.preventDefault();
		handleFiles(e.target.files?.[0]); //other func that recieves(file:any)
	};

Matiasdevv avatar Apr 09 '24 15:04 Matiasdevv

same here

deKadir avatar May 11 '24 20:05 deKadir

How about fixing this issue asap?

Default-01 avatar Jul 06 '24 13:07 Default-01

@Default-01 The PR is being reviewed. The fix will be available in the next bug release. Please be patient.

wingkwong avatar Jul 06 '24 13:07 wingkwong