DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
20.46k stars 786 forks source link

File Input on Desktop Not Displaying File Dialog When Clicked #2132

Closed matteron closed 6 months ago

matteron commented 6 months ago

Problem

Using rsx! { input { r#type: "file" } } to create a file input correctly inserts the element, but clicking on the input does not open up a file dialog for the user to pick a file.

Steps To Reproduce

Steps to reproduce the behavior:

Expected behavior

A native file dialog opens up and allows the user to select files.

Edit: More Info I should emphasize, I barely understand the codebase yet, but doing some preliminary investigation I seem to have found the problem might be related to the input element not having a "data-dioxus-id" attribute assigned to it causing the event to get ignored in the event listener in native.ts line 65 since getTargetId is returning null in this case.

Environment:

Questionnaire

jkelleyrtp commented 6 months ago

Well........ if you attach an oninput listener to the input event the file dialog does show - it's just weird that without the listener we don't show the dialog.

This works:

rsx! { input { r#type: "file", oninput: move |_| {} } }

Is there actually any utility for file inputs on desktop that don't handle the file?