tr:panelPopup positions itself with regards to the document body, not the 
offset parent
---------------------------------------------------------------------------------------

                 Key: TRINIDAD-673
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-673
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.0.2-core
            Reporter: Andrew Robinson


I have been working for a large part of the day on my own renderer of the 
tr:panelPopup as the core one unfortunately doesn't work for my needs. The 
problem is that the PanelPopup.js assumes that the panel's offsetParent is the 
document.body/window. With CSS styling, this is very rarely the case. As a 
result a tr:panelPopup inside of a relative or absolute HTML element will not 
be rendered in the correct location on the screen. 

Furthermore, the panel is often not visible if the parent's overflow is hidden. 

Proposed solution:

The best way to ensure that the popup is positioned correctly is to have all 
measurements made using absolute (page) co-ordinates. Also, it is imperative to 
have the popup inside a container that is not cropped or scrolling in any way 
to ensure the dialog stays visible. 

Steps:

1) When the popup is shown, move it to the parent FORM element (use the form to 
ensure that form elements inside the popup do not break)
2) if the popup is not in a form, then relocate the popup to the document.body
3) have event listeners on the popup and the trigger.
4) in the mouse out, check to see if the events X and Y co-ordinates fall in 
the page X and page Y co-ordinates of either the trigger or the popup. If the 
event is outside both sets of co-ordinates, hide the popup
5) when hiding the popup, move it back to it's original parent

Technical notes:

- to determine absolute co-ordinates relative to the page, one must loop 
through all the parent nodes, checking offsetTop and offsetLeft until the 
offsetParent is null





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to