TWebSideMenu blocks TWebPopupMenu

Hi,

I have a slightly odd issue: I don't know if it is a bug or if I am doing something wrong. It can be reproduced as follows.

Create a new TMS Web Application project. Add a TWebSideMenu, a TWebPanel with a TWebLabel, and a TWebPopupMenu with a single menu item. Set WebPanel1 as the "ContentControl" of the first item in the WebSideMenu.

Now add an OnMouseDown event for the panel and an OnClick event for the popup menu item as follows:

procedure TForm1.WebPanel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  WebPopupMenu1.Parent := WebPanel1;
  WebPopupMenu1.Popup(X, Y);
end;

procedure TForm1.Test1Click(Sender: TObject);
begin
  WebLabel1.Caption := FormatDateTime('hh:nn:ss', Now);
end;

So, you click on the first item in the side menu to display the panel. Then, when you click somewhere on the panel it pops up the menu where you clicked and then when you select the popup menu item it puts the current time in the label, just so you know it did something.

This works perfectly when the side menu is expanded or collapsed, but when it is in the popup state (hidden with the hamburger menu) you cannot click the popup menu item - it is blocked by a span with a higher z-index that covers it.

Now, I know what is causing this problem: it is the line where I change the parent of the popup menu to be the panel. If I remove that line then the problem goes away. So, that seems like the fix then, right? Well, no, because it my real, more complicated situation, I create a TWebFrame inside the panel, and that frame has a popup menu, and it has the same problem. It seems that if the popup menu's parent is not the main form, the problem occurs. But only if the side menu is in the popup state.

Thanks!

It seems to be a non-trivial issue. We'll allocate time to investigate what the best solution could be.

When the PopupMenu parent is set to the panel, the popup menu becomes a child element under the panel and this popup element no longer receives the first mouse input due to the SideMenu popup layer. We see no easy solution for this and it is unclear why you want the PopupMenu parent to be the WebPanel. I suggest to set the PopopMenu parent to the main form or leave it unassigned.

The above example was just to demonstrate the problem, and I agree there is no reason to want the PopupMenu parent to be the WebPanel in that case. However, I am making an app that uses multiple TWebFrames to create a dashboard of windows as shown below, and each window has it's own popup "control menu". In this case the popup menu's parent is the TWebFrame, which in turn has the WebPanel as its parent.


The popup menu's parent is set to the TWebFrame at design time. If I change it to nil at runtime then the menu doesn't appear, and if I set it to the main form then it doesn't display properly.

I can live with this as it is. But, I wondered why it is only an issue when the side menu is in the popup (hamburger) state.

Thanks.

The reason is that in the popup hamburger state, a HTML SPAN needs to be inserted to capture mouse actions outside the popup menu (to close the popup again and let no other control interact with the mouse outside the popup while it is open). This interferes with the popup. It is a non trivial issue for a generic solution. We keep it on our agenda to try to find an improvement for this, but for now, make the parent of the popup menu the form.