I'm trying to use driver.js to create a guided tour around the Gutenberg editor for clients, but I'm having trouble finding what the correct way to query the elements is.
When I try to use querySelector
it comes back null regardless of whether or not I wrap everything with a DOMContentLoaded
event listener. I saw on the wp
object that it has a function you can add a callback to as well called domReady
, but that doesn't work either. The only thing that has worked is wrapping everything in a setTimeout
to ensure that the element I'm trying to select is in the DOM.
Is there an api to get ensure I'm only getting these editor elements after they're rendered on the page? For example, how would I select the settings button in the header that pulls out the sidebar on the right side of the editor?