Question: Modal with Interactivity API #63907
Replies: 2 comments 6 replies
-
It's about what works best for you, but it's true that for the
|
Beta Was this translation helpful? Give feedback.
-
I'm currently looking at developing a modal block and am keen to implement using the HTMLDialogElement |
Beta Was this translation helpful? Give feedback.
-
Looking to build a modal block with the interactivity api but want to know what’s the best way to approach it? How would you guys structure it?
As I see it, to make a modal I have a couple options. Create (2) blocks. One block would controls (items that can be clicked to change state, etc.) and the other block to listen for changes in the state of the block above and structures the modal that will be placed in the footer.
Or create one block. Then inject the modal markup with directives and hook it to the wp_footer (with hooks) and show based off of the state. If that makes sense?
Or do you guys have any other ideas how this could be implemented with the IAPI?
Thanks for any feedback!
Beta Was this translation helpful? Give feedback.
All reactions