w3c / w3c/webdriver

Files selected for <input type=file> should be validated against ‘accept’ attribute

Open
#1,269 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Element Send Keys
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

In chapter 14. Element Interaction, section 14.3 Element Send Keys:

Complete implementation specific steps equivalent to setting the selected files on the input. If multiple is true files are be appended to element’s selected files.

There is no provision to validate selected files against the 'accept' attribute. For example, this is defined here:

https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file)

It is also noted above that "User agents should prevent the user from selecting files that are not accepted by one (or more) of these tokens." I think it's worth referencing this or otherwise hooking into the validation that would be done by the UA in a real user scenario.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with section 14.3, Element Send Keys, and compare its implementation-specific steps with the HTML file-upload-state specification linked in the issue. Determine whether the WebDriver text should reference or require validation against the accept attribute; done means the specification's expected behavior is explicit and consistent with the referenced HTML guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.