purescript-halogen icon indicating copy to clipboard operation
purescript-halogen copied to clipboard

open and showModal are missing for dialog

Open jquesada2016 opened this issue 2 years ago • 15 comments

I saw that diallog had an open row in it's attribute row type. However, I don't see any functions to create the open attribute for the dialog element.

Also, showModal would be a great addition, although it is neither a property nor an attribute, as per the spec, but it might not be a bad idea to add it as a helper prop where the VDom can call .showModal() and .close() on the element as the prop is added/removed.

jquesada2016 avatar Oct 29 '23 15:10 jquesada2016

@jquesada2016 can you point to the relevant documentation?

flip111 avatar Jan 17 '24 22:01 flip111

Is this good enough?

jquesada2016 avatar Jan 20 '24 15:01 jquesada2016

I agree that being able to control this via property would be much more pleasant to deal with, I think it'll need special support in Prop in halogen-vdom most likely. I don't think we'd need a separate showDialog though, it could use the open property for that.

garyb avatar Jan 22 '24 14:01 garyb

I believe we would definitely need a showModal property, because open and showModal have very different behaviors. open shows the modal, but does not render, by default, an overlay, and elements underneath the modal are still interactive. Whereas showModal opens the dialog in modal mode, showing an overlay by default, and prevents elements under the dialog from being interacted with.

jquesada2016 avatar Jan 22 '24 14:01 jquesada2016

Ah whoops, of course. What I meant then is I think open would also need special handling as I think you have to call show rather than just setting it.

garyb avatar Jan 22 '24 14:01 garyb

Yes! Exactly right. Setting the open attribute only works when initially rendering the HTML in SSR. After the page has loaded, you need to call el.show() or el.showModal(), and el.close() to close it.

jquesada2016 avatar Jan 22 '24 17:01 jquesada2016