I am working on designing a context menu for specific elements utilizing a PopupPanel
; the context menu is expected to be quite extensive and intricate. My goal is to have a collection of buttons, an image, and some text associated with the clicked element.
The challenge I face is ensuring that the buttons always appear directly under the selected element for user convenience. However, when the PopupPanel
is positioned near the screen edges, it automatically readjusts its position to guarantee full visibility, thus deviating from aligning with the left side of the element as desired. While this behavior is beneficial, it displaces the button alignment.
My ideal scenario involves having the buttons typically located on the left side of the panel with other content on the right. When the panel approaches the right edge of the screen, my wish is for the buttons to shift to the right (and consequently beneath the clicked element) while keeping the remaining content on the left.
Is there an ingenious way to achieve this, whether through GWT or exclusively using CSS? Unfortunately, PopupPanel
does not provide information regarding when it is going to reposition itself. Currently, my only solution involves manually assessing the popup's position and width before display to make adjustments, but I am optimistic about finding a more efficient approach.