whatwg / whatwg/html

Define `<input capture>`, ideally with a hint for which camera to use

Open
#1,102 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue integration topic: forms
Dominant language
HTML
Stars
9.4k
Forks
3.2k
Avg merge
3d 9h
Merged PRs (30d)
38

Description

2023-12-13 summary by @domenic of the work to be done:

We need to upstream https://w3c.github.io/html-media-capture/ into HTML. The core logic is in https://w3c.github.io/html-media-capture/#the-capture-idl-attribute, and needs to be updated to be consistent with the HTML Standard's existing conventions, such as:

  • Being located in the right place, i.e. in HTML's definition of HTMLInputElement, the File Upload state, and the "show the picker, if applicable" algorithm.

  • Adhering to HTML's editorial style, e.g. defining enumerated attributes using the same table format as other enumerated attributes, using lowercase "must" and "should", etc.

Additionally, some portions of user agent advice that are currently in "security and privacy considerations" need to move into the normative text.

For the examples section, not all of it needs to be ported over, but porting over 1-3 HTML or JS code examples and also the file picker rendering examples to https://html.spec.whatwg.org/#file-upload-state-(type=file) would be good.

Finally, we need to add authoring conformance requirements on the capture attribute. This would be done by modifying all the discussion about "apply" and "do not apply" in https://html.spec.whatwg.org/#the-input-element; use the existing accept attribute as a model. It seems we'll need an additional authoring conformance requirement that the attribute must only be specified if the accept attribute is also specified.

In general, the accept attribute, as another attribute which only applies in the File state, is a good model.

Original post follows:

IIRC <input capture> isn't actually defined in a spec that's being actively maintained, and offhand I don't know why it wouldn't be defined in HTML with the rest of <input>'s attributes. Ideally its value could be taken from VideoFacingModeEnum, (which would be taken as a hint for which camera is preferred). If capture="" has to remain a boolean attribute for compat reasons, I suppose we'll have to mint a new attribute to carry the hint.

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 by reading the HTML Media Capture definition of the capture IDL attribute and compare the HTML Standard's HTMLInputElement, File Upload state, show-the-picker-if-applicable algorithm, and input element sections. Use the accept attribute as the model for placement, enumerated-attribute style, and authoring conformance requirements. Done means the capture behavior, normative user-agent advice, selected examples, and accept dependency are integrated into the HTML Standard.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.