Both of the CodePen example links on that page are insidiously broken. The demos appear to work, but they don't actually demonstrate the claimed portal functionality at all:
// These two containers are siblings in the DOM
const appContainer = document.getElementById('app-container');
const modalContainer = document.getElementById('app-container');
Note that both variables refer to the same element.