When using simple dialog with a very big page the dialog is not centered on the viewport, but on the document instead, which could cause the dialog to fall off screen.
I experienced this issue already when using 6.0 so I thought it was time to investigate. When the content height of the page (the document) is larger then the window (the viewport of the browser), then you can clearly see that instead of centering on the window, the dialog is centered on the document. When having very large pages, the dialog is still centered on the page level, and not on the window level. It means that if the page is at least twice as high as the window, the dialog falls of the window. To test this i made a sample page:
Code: Select all
<html lang="nl" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form id="show">
<p:commandButton value="Test" onclick="PF('dialog').show();" />
</h:form>
<p:dialog id="dialog" header="dialog" widgetVar="dialog" modal="true" height="100">
<h:form id="refresh">
<p:button onclick="document.location.href = document.location.href;" value="Refresh" />
</h:form>
</p:dialog>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</h:body>
</html>
The odd thing is, when testing this on the Primefaces showcase, and resizing the screen, the dialog is always centered! Conclusion is there is something different, but I only use base configuration for primefaces. I noticed though that everything is wrapped in layout container on the primefaces site. Also tried to wrap everything in a layout container, but it doesn't help.
Anybody has an idea why this happens. Is this a bug I should report? Is this as designed, and the dialog will ALWAYS center on the document (and for a strange reason the showcase doesn't follow this logic...).