Pagecontainer: Correctly identify the current page as a dialog

Closes gh-7541
Fixes gh-7538