I'm trying to make a cross-platform file picker co...
# compose-web
m
I'm trying to make a cross-platform file picker component with drag-and-drop support, but the only references I can find involve AWT or Swing. How would I accomplish this in JS? (or WASM if JS isn't possible)
👀 1
d
The browser is very limited into what access it gives you to the file system, which I suspect is related to security. I don't think you can make a custom file picker in the world of HTML. (I'm not sure if WASM is different)
m
It should be possible though, no? In the DOM, we can use
<input type="file">
so it should be possible to replicate right?
To be clear, I'm using the new Compose for Web that uses a canvas backend, not the Compose for DOM that was previously the only web target.
d
I'm not authoritative here, there could be things I don't know! But "canvas" is still just an HTML element that's part of the DOM, I'd suspect.
When you use
<input type="file">
the browser opens up a file picker but you have very little control over it. As far as I'm aware, you're not even told if the user cancels it. You just pass in a few config values and a callback and then it's out of your hands.
k
any update on this @David Herman @martmists
d
I just realized I didn't understand the original question, sorry about that @martmists . I thought you were trying to control the file picker that popped up. Instead it sounds like you're trying to support drag/drop on the canvas itself (perhaps to populate things with an initial file)? @Kapil Yadav are you looking to do this in Compose Web Multiplatform or Compose/HTML (with the DOM?)
k
Web multi-platform or the canvas one
d
Ah sorry I don't know about that one
k
Or just a ui like in dom file picker, how to do that in canvas?