Project

General

Profile

Bug #5222

WPopupMenu does not open anymore

Added by Matthias N almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
08/23/2016
Due date:
% Done:

0%

Estimated time:

Description

1. Compile and run the Demo

#include <Wt/WApplication>
#include <Wt/WPushButton>
#include <Wt/WPopupMenu>

class CSessionApplication : public Wt::WApplication {

public:
    static Wt::WApplication* CreateApplication(const Wt::WEnvironment& env) {
        return new CSessionApplication(env);
    }

private:
    Wt::WPushButton *c_pMenuButton = nullptr;
    Wt::WPopupMenu *c_pMenu = nullptr;

    CSessionApplication(const Wt::WEnvironment& env) : Wt::WApplication(env) {
        c_pMenuButton = new Wt::WPushButton("Menu");
        c_pMenu = new Wt::WPopupMenu();

        c_pMenu->addItem("Entry 1");
        c_pMenu->addItem("Entry 2");
        c_pMenu->addItem("Entry 3");
        c_pMenu->addItem("Entry 4");

        c_pMenuButton->setMenu(c_pMenu);

        root()->addWidget(c_pMenuButton);
    }
};

int main(int argc, char* argv[]) {
    return Wt::WRun(argc, argv, &CSessionApplication::CreateApplication);
}

2. Open demo in browser (tested in firefox 48)

  1. Open the menu, wait a moment and click 3 time fast on the button or double click really fast (sometimes it works, therefore try it more often).
    -> sometimes menu does not open anymore.

If you run the demo on localhost you should use some tools to simulate network lag/drop to better reproduce the bug (e.g. "cumsy 0.3", tested with lag 50ms/drop 10% for all sending packets).

I also can reproduce the bug with the navbar example (https://www.webtoolkit.eu/widgets/navigation/navigation-bar) on the "Help" button.

It looks like the problem comes from the first two lines in WPopupMenu::popupAtButton().

- client thinks the menu is close -> request open

  • server think "its open" -> do nothing

    void WPopupMenu::popupAtButton()
    {
    if (!isHidden())
    return;
    ...

No data to display

Also available in: Atom PDF