-
Notifications
You must be signed in to change notification settings - Fork 31
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
setFormValue() is incompleted #17
Comments
Hey, I'd be happy to take a look at a PR addressing this issue, but I'm not sure of a really good way to do this just yet. I'll do some research. I'll ping @BurnedToast as well. My issue with the comment is that I don't know the best way to determine if you want that element to be a file … maybe I can take a look at the type of data being passed to the first argument of Let's chat about this one. |
My scenario is similar with https://web.dev/more-capable-form-controls/#setting-a-value . My Preview File Input component needs to set a |
I also thought about opening a new issue on this one. Thanks @TechQuery for doing so. I am currently on vacation, but i could invest some more time into this one next year :) |
@BurnedToast @calebdwilliams Happy new year, stay strong, and away from COVID-19~ |
Looking at this again, I'm not sure it makes sense to add because there doesn't appear to be a reliable way to support this feature in Safari. One of the goals here should be to create a consistent experience as best we can. Having this work in Firefox and not in Safari (or IE11/older versions of Edge) could lead to some apps not working. I'm tempted to mark this as Edit |
After some research I could not find any solution for Safari, that could be integrated into this polyfill. But I found a possible workaround for my use case, that should also work for you @TechQuery. So you could just handle a hidden input-file-element by your own and copy the files property. Here is a code pen showing how to transfer the selected files from one input to another: The creation of the "ghost input" outside the shadow root is not included. Hope this helps |
For my FileUpload-Component, that internally uses an input type="file" element, I ended up using attachInternals() to get support for all the other polyfilled stuff (validation etc). I just replaced the code for "elementInternals.setFormValue" with the following:
|
@BurnedToast Thanks your example codes~ My File Input component did use I feel sad for Safari users... |
Same. My buddy recently put this together to illustrate that web devs now have a new problem on our hands. I’m going to keep this issue open and hopefully add a caveat to the README about this. I am interested in any solution that hits all modern browsers (bonus points for IE11 compatibility). |
@calebdwilliams Thanks your buddy, and I'll show https://issafarithenewie.com/ to my clients~ Add one more reason to this site: Every browser on iOS is Safari indeed ! |
@TechQuery @BurnedToast this seems to work in the latest version of Safari based on the Pen linked above. Can anyone confirm? If so, is anyone interested in opening up a PR for this? |
Following up @TechQuery, @BurnedToast is this still a need? |
I did not had the opportunity to test this, since I do not have any Safari test devices currently. |
Me too, I'm a Windows/Linux user. |
|
@calebdwilliams too busy to create a PR atm, but if you want to use the same typing as Typescript, try this: |
What I expect
Related links
The text was updated successfully, but these errors were encountered: