Question: Modal with Interactivity API #63907
Replies: 3 comments 8 replies
|
It's about what works best for you, but it's true that for the
|
|
I'm currently looking at developing a modal block and am keen to implement using the HTMLDialogElement |
|
@luisherranz A little off-topic, but if I were going to write a modal, how viable do you think it is to re-use parts of the image block iAPI? Or would it be best to duplicate everything? I am specifically think about the opening/closing/focus/styling of the overlay itself and not necessarily the content. |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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!
All reactions