-
Notifications
You must be signed in to change notification settings - Fork 47.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for capture
attribute
#4784
Comments
What version of react are you using? The support for it is here: https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L60 and testing it really quickly kept the capture attribute on the rendered element. If you read the more information link you provided you'll see it expects an "accept" attribute on the input element, perhaps that's the issue you are experiencing? |
You were right about it missing from the docs tho, so I submitted #4788 to resolve. |
This was added in React 0.14, which you can play with in the beta, and the final release should be coming very soon now. |
Anyway to get this in 0.13 right now? We need it desperately. |
@milesj No, sorry. We'll release 0.14 soon (RC this week, probably) but before then you can simply access the DOM node with a ref and set the attribute manually. |
I'm using 14.2 and this doesnt appear to be fixed. |
@ccorcos As per #4784 (comment), it appears to be in the code. Do you have a simple jsfiddle that demonstrates your issue? |
https://jsfiddle.net/ccorcos/jqyxqe0d/4/
|
According to the spec, capture is a boolean attribute: http://www.w3.org/TR/html-media-capture/#the-capture-attribute There are some sources places that specify string values for the capture attribute (http://mobilehtml5.org/ts/?id=23) and some browsers appear to honor that, but it doesn't look like it's part of the spec. Furthermore, the spec seems to indicate that users specify the Do you know of a situation where the |
I'm just trying to deal with some quirks on old Android browsers. Some stackoverflow questions pointed toward the need for |
@zpao Is there any harm in specifying this as a |
No harm. (@syranide's pending DOM removeAttribute pull request should change everything to use attributes.) |
It's unrealistic to support all quirks in all old browsers. It would be helpful to know which ones and if we should support then.
Not quite true (at least not based on my understand of what @jimfb was saying) The boolean logic currently allows us to specify |
So is there any walkaround way to force set string value to capture attribute? This is really important for mobile browsers where you can specify which camera to use when capturing image (front / rear) and since WebRTC is not supported in Safari and iOS, it seems to be the only way to get camera image from user. See for example: https://codepen.io/Guntrisoft/details/OpBOrE UPD: Seems that simply adding <input
type="file"
accept=".jpg,.jpeg"
is capture="user"
/> Found solution here |
The |
Trying to use
<input type="file" capture="camera"
/ >and the
capture` attribute is not getting renderedDoesn't look like its supported in the list at:
https://facebook.github.io/react/docs/tags-and-attributes.html#html-attributes
More information on capture at:
http://www.w3.org/TR/html-media-capture/#introduction
The text was updated successfully, but these errors were encountered: