Bug 187084

Summary: `change` event for input[type=file] does not fire when different file with same name is selected
Product: WebKit Reporter: Mariko Kosaka <mariko.kosaka>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, ahmad.saleem792, akeerthi, ap, bfulgham, commit-queue, d, mparmaksiz54, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.13   
See Also: https://bugs.webkit.org/show_bug.cgi?id=227799
Bug Depends on: 246158    
Bug Blocks: 246143    

Description Mariko Kosaka 2018-06-26 22:40:59 PDT
https://codepen.io/anon/pen/eKPJda?editors=1010

Steps to reproduce:
1. [input]select file1 on <input type="file"> 
  => change event is fired
2. [input]select file1 again
  => change event is NOT fired
3. Delete the file1, rename file2 to same name as file2
4. [input]select file2 (same file name as file1) 
  => change event is NOT fired

video : https://youtu.be/hrt6ll73kNk

Expected:
Change event is fired every-time user select a file on prompt. Regardless of filename or even when same file is selected twice.
Comment 1 Mariko Kosaka 2018-06-27 10:41:14 PDT
Typo on reproduce instruction: 
3. Delete the file1, rename file2 to same name as *file1*
Comment 2 Lucas Forschler 2019-02-06 09:19:08 PST
Mass move bugs into the DOM component.
Comment 3 Domenic Denicola 2021-07-08 09:44:46 PDT
See also https://bugs.webkit.org/show_bug.cgi?id=227799
Comment 4 Ahmad Saleem 2022-08-09 13:34:06 PDT
I am able to reproduce this bug in Safari 15.6 on macOS 12.5 and when selecting same file again, there is no "change event", it is only fired when I select another file. It is matching with Chrome Canary 106 but differs from Firefox Nightly 105, which fires change event every time I select file even if it is same file. Just wanted to share updated results. Thanks!

Also I think, this might be same as 227799 but just going to update this. Thanks!
Comment 5 Radar WebKit Bug Importer 2022-08-10 10:59:56 PDT
<rdar://problem/98460303>
Comment 6 Aditya Keerthi 2022-08-10 15:13:25 PDT
https://bugs.webkit.org/show_bug.cgi?id=227799 is related, and is a nicer way of handling (2), where the same file and filename are selected.

I think we should still fire a change event for (4) though, when the name is changed.
Comment 7 Richard Robinson 2022-10-03 14:46:32 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4943
Comment 8 EWS 2022-10-05 22:58:42 PDT
Committed 255209@main (5374937e8566): <https://commits.webkit.org/255209@main>

Reviewed commits have been landed. Closing PR #4943 and removing active labels.
Comment 9 WebKit Commit Bot 2022-10-06 08:38:56 PDT
Re-opened since this is blocked by bug 246158
Comment 10 Richard Robinson 2022-10-06 09:40:39 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5089
Comment 11 EWS 2022-10-07 15:22:13 PDT
Committed 255297@main (14b28281c8d0): <https://commits.webkit.org/255297@main>

Reviewed commits have been landed. Closing PR #5089 and removing active labels.