Closed Bug 1610726 Opened 5 years ago Closed 4 years ago

File input click not working for blazor application

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1678389
Tracking Status
firefox72 --- affected
firefox73 --- affected
firefox74 --- affected

People

(Reporter: vinayagamnavin, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

(deleted), application/x-zip-compressed
Details
Attached file BlazorApp.zip (deleted) —

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

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.

Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Core & HTML
Ever confirmed: true
Product: Firefox → Core
Version: 72 Branch → Trunk

This looks like user activation related, I will take a look.

Flags: needinfo?(echen)

(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.

Blocks: 1577516
Flags: needinfo?(echen)
Priority: -- → P3

(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?

Flags: needinfo?(echen)

bug 1678389 should fix this / make it match other browsers, afaict

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(echen)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: