File input click not working for blazor application
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
People
(Reporter: vinayagamnavin, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
application/x-zip-compressed
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
Hi ,
I am creating a blazor application in which I am using the hidden file input and click() method to open the file picker. It works fine in Chrome, Edge. The file picker is not opening in Firefox. File Picker is opening if I created a similar app using pain javascript and HTML
Below is my sample code to reproduce the issue.
index.razor:
@inject IJSRuntime JSRuntime;
@*File Input is clicked using JSinterop on blazor click event of button*@
<div>
<button @onclick="OnClick">Select File</button>
<input type="file" id="fileElem" multiple style="display:none">
</div>
@code{
private async Task OnClick()
{
//Triggers the click event of file Input
await JSRuntime.InvokeVoidAsync("elementClick", "fileElem");
}
}
`````
JSInterop file:
````
window.elementClick = (Id) => {
// Triggers click event of the element
document.getElementById(Id).click();
};
`````
Is there any work around to resolve the above issue?
FireFox Version: 72.0.2
Visual Studio : Version 16.5.0 Preview 1.0
DotNet SDK Version: 3.1.100
Actual results:
File Picker is not opening when File input click is triggered using a separate button for blazor application alone
Expected results:
File Picker should opening when File input click is triggered using a separate button for all type of applications
Comment 1•5 years ago
|
||
Hi,
I was able to reproduce this issue on Windows 10 with Firefox version Nightly 74.0a1 (2020-01-27) (64-bit) - Beta 73.0b10 (64-bit) - Release 72.0.2 (64-bit). Marking those flags as affected.
I'm setting the component to CoreDOM: Core & HTML.
Comment 2•5 years ago
|
||
This looks like user activation related, I will take a look.
Comment 3•5 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #2)
This looks like user activation related.
Opening FilePicker will check popup blocker status, https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/dom/html/HTMLInputElement.cpp#731-733. Right now, popup blocker only support propagate state through some async callback. To make this work, we need to move popup blocker to new user activation model.
Comment 4•4 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #3)
(In reply to Edgar Chen [:edgar] from comment #2)
This looks like user activation related.
Opening FilePicker will check popup blocker status, https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/dom/html/HTMLInputElement.cpp#731-733. Right now, popup blocker only support propagate state through some async callback. To make this work, we need to move popup blocker to new user activation model.
I'm facing the same issue reported by @Navin. Can this be resolved by any solution or a workaround in my Blazor application? If yes, can you please share us some helpful details regarding it?
Comment 5•4 years ago
|
||
bug 1678389 should fix this / make it match other browsers, afaict
Updated•4 years ago
|
Description
•