Closed Bug 1723629 Opened 5 years ago Closed 5 years ago

"accept" attribute on file input is ignored for unknown MIME types

Categories

(Core :: DOM: Forms, defect)

Firefox 90
defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: sam, Assigned: evilpies)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

https://js-9q2pd7.stackblitz.io

  1. Click the upload button
  2. Browse to a folder that contains files that are not videos

Actual results:

All files are allowed to be selected

Expected results:

Only video files should be selectable

Link to same as above, plus source: https://stackblitz.com/edit/js-9q2pd7?file=index.html

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Thanks for the report. As far as I can tell it's not really being ignored, but maybe there is something platform specific about this. On Linux Fedora, I see "All files" is selected by default, but there is also an option to select "All supported types".

For reference the test case is just: <input accept="video/quicktime,video/mp4,video/mpeg,video/m4v" multiple="multiple" type="file">. accept="video/*" might produce the desired results.

Status: UNCONFIRMED → NEW
Component: Audio/Video: Playback → DOM: Forms
Ever confirmed: true

By comparison, when the value is accept="audio/x-wav,audio/wav,audio/x-aiff,audio/aiff,audio/mpeg,audio/x-m4a", it works as expected. And yes, video/* does work, but it's not my desired outcome, as we don't want to accept all video file types.

BTW, this occurs on both Mac & Windows.

See Also: → 1724890

(In reply to Tom Schuster [:evilpie] from comment #3)

Thanks for the report. As far as I can tell it's not really being ignored, but maybe there is something platform specific about this. On Linux Fedora, I see "All files" is selected by default, but there is also an option to select "All supported types".

Same on Windows, so it might not actually be platform specific.

Removing video/m4v makes things as expected, just as the behavior seen in https://bugzilla.mozilla.org/show_bug.cgi?id=1724890#c2

Chrome does not default to All files even when there is a random unidentified media type. I guess Gecko should follow them.

BTW, replacing video/m4v with video/x-m4v also fixes it.

Bug 826176 required all media types to be supported in order to make All Supported Types as default:

https://searchfox.org/mozilla-central/rev/4cca5d2f257c6f1bcef50a0debcbd66524add703/dom/html/HTMLInputElement.cpp#6927-6932

:smaug, can we follow what Chrome does or is there still a valid reason to keep the current behavior?

Flags: needinfo?(bugs)
Summary: "accept" attribute on file input is ignored for video MIME types → "accept" attribute on file input is ignored for unknown MIME types

I am not sure why this is suddenly producing so many dupes, maybe Chrome changed their behavior? I am going to try and change our implementation.

Assignee: nobody → evilpies
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/81b10f4232c8 Use the 'All supported types' filter even when some MIME types are unknown. r=saschanaz
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: