NEW 234566
<input type="file"> fails to show and displays inappropriate file types
https://bugs.webkit.org/show_bug.cgi?id=234566
Summary <input type="file"> fails to show and displays inappropriate file types
goldwaving
Reported 2021-12-21 09:34:31 PST
First issue: Using the following code, when the Open button is clicked the file picker window does not appear. It does appear on Chrome and Firefox. This kind of deferred display is necessary for multi-threaded web apps. A webworker may be sending a message to display the file picker. However Safari does not show it presumable because the original click event is not considered in this context. <input id="file" style="display:none" type="file" accept=".m4a,.mp3,.wav,.ogg,audio/*"> <button onclick="show=true">Open</button> <script> const file = document.getElementById( 'file' ); var show = false; setInterval( () => { if ( show ) { show = false; file.click(); } }, 200 ); </script> Second issue: When displaying the file picker on iOS, it always displays a popup for "Photo Library", "Take Video", and "Choose File" even when "accept" does not specify images or video. This is a very inappropriate and unnecessary popup when an app is accepting only audio files, only PDF files, etc. Third issue: On iOS there is no change in focus when the popup or file picker appears. Many developers rely on focus changes to determine if the file picker was cancelled (because there is no cancel event in the specification).
Attachments
Radar WebKit Bug Importer
Comment 1 2021-12-28 09:35:15 PST
goldwaving
Comment 2 2023-01-26 06:06:45 PST
This design flaw also affects AudioContext, navigator.share, uploading/downloading as well. Rather than using a timed based method (such as https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation) webkit wrongly uses a context based method. Firefox and Chrome do not have such a short sighted, inflexible design.
Note You need to log in before you can comment on or make changes to this bug.