I've got a modal component (using Vue 2.6.x) that opens and displays perfectly the first time I click the button to open it.
But if I close it (and the component gets destroyed), and then try to open it again, the component mounts and gets its props just as it should. But it is not visible. Looking at the html in DevTools, it says "null" where the modal content is supposed to be inserted just below the <body> element. The console shows no errors.
HTML (abbreviated) when modal opens the first time:
<body class="county-index auth" style="">
<div id="modal-container" class="modal-backdrop">
<dialog aria-modal="true" aria-describedby="modal-desc" tabindex="-1" class="dialog modal-dialog">
<div role="document">
<div class="widb-row widb-county-modal-header">
<h2 id="county-heading-modal">Waukesha County</h2>
<p id="modal-desc">Some key facts about Waukesha County connections to UW–Madison</p> <p>2184
Current Undergraduate Students
</p> <p>1966
Medical Professionals with degrees from UW
</p> <p>16325
Alumni
</p></div> <p><a href="/counties/67">More Waukesha
County connections to UW–Madison</a></p>
<button type="button">
Return to Map
</button>
<button type="button" aria-label="Close">
</button>
</div>
</dialog>
</div>
[...]
HTML when modal is closed and then opened a second time:
<body class="county-index auth" style="">
null
<header class="uw-header" aria-hidden="true" inert="true"><a class="uw-show-on-focus" href="#main" id="uw-skip-link">Skip to main content</a>
<div class="uw-global-bar">
<a class="uw-global-name-link" href="http://www.wisc.edu" aria-label="University of Wisconsin Madison home page">U<span>niversity <span class="uw-of">of</span> </span>W<span>isconsin</span>–Madison</a>
<ul class="login-meta top-right links">
[...]
Some additional context: opening and closing the modal is done with v-if, and an additional 'v-show in the modem component based on a prop. Opening the modal does some DOM manipulation so that the modal becomes the first element after <body>, and everything else is assigned inert=true using the inert-polyfill. But this works perfectly the first time, and upon close, the DOM is returned to its original state. Everything appears to be the same, but something must be different.
I just can't figure out why the modal won't appear the second time, and why "null" is inserted into the html.