-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Blazor file input click not working in firefox #20228
Comments
@xFirestorm thanks for contacting us. A few questions:
|
I am experiencing a similar issue with Firefox 74.0 (64-bit) but not in Chrome 80.0.3987.149 (64-bit). Additionally, I get this error with Firefox that I do not get with Chrome "Error: Found malformed component comment at Blazor". I am able to pause the debugger inside Chrome but not in Firefox. Additionally, Firefox does not show any event listeners when inspecting while Chrome does. Environment .NET Core SDK (reflecting any global.json): Runtime Environment: Host (useful for support): Full Firefox Error: |
I just gave this a quick try on Firefox. I'm not able to see any error in the browser console as you are reporting, but I suspect it is unrelated. I can't get the select file dialog to show, but I believe that is a firefox specific issue and not a Blazor issue since I am able to hit the JavaScript handler without problems. I suggest you find an alternative approach to do this, since it is likely firefox might be preventing you to do this for security reasons (it is suspicious to trigger a menu from a hidden element, but this is just my speculation) |
It's not a firefox security feature. Plain html is working. See here: https://jsfiddle.net/chxnbmqt/ There are many other way's to achieve custom styling of a file input element (already implemented another way). Still i think this may be a bug related to blazor, correct me if wrong. |
I cannot reproduce the issue in plain HTML. I am hitting the debugger debugger inside |
@javiercn Maybe we should reopen this issue for some deeper investigation |
Describe the bug
Trigger a click event via Javascript on an input element of type file is not working.
When searching the web for my problem i found this stackoverflow thread.
To Reproduce
Create an input file element in a razor component. Then create a button on the component. On the button click call a void, inside the void method call the IJsRuntime invoke method to trigger your js function that clicks the input file element by id.
In Firefox this is not working while in Edge f.ex. it does.
Example from stackoverflow:
Further technical details
dotnet --info
IDE: VS
netcoreapp3.1
dotnet --info:
.NET Core SDK:
Version: 3.1.101
Commit: b377529961
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support):
Version: 3.1.2
Commit: 916b5cba26
.NET Core SDKs installed:
2.2.207 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
The text was updated successfully, but these errors were encountered: