JUCE
JUCE copied to clipboard
[Bug]: WebBrowserComponent does not respect accept attribute on a file input
Detailed steps on how to reproduce the bug
Tested this on macOS, if you use WebBrowserComponent to display an html with a file input like this:
<input type="file" accept="image/png" >
The accept attribute is used to restrict the files that the user can select, it can either be a mime type or a list of file endings. Sadly this does not work in WebBrowserComponent, it always allows all files.
There are two places in WebBrowserComponent where the FileChooser is opened with '*' as a file filter instead of the accept attribute from the input above:
JUCE/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm:213
JUCE/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm:345
In my tests only the one on line 345 was called. I think the file filter from the input can be accessed through WKOpenPanelParameters (_allowedFileExtensions).
What is the expected behaviour?
Use the file filter that was defined on the file input.
Operating systems
macOS
What versions of the operating systems?
Ventura 13.2.1
Architectures
x86_64, ARM, Other, 64-bit, 32-bit
Stacktrace
No response
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
I have not tested against the develop branch
Code of Conduct
- [X] I agree to follow the Code of Conduct