Project

General

Profile

Actions

Bug #7139

closed

Popupmenu

Added by Sebastian Fett almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Target version:
-
Start date:
07/10/2019
Due date:
% Done:

0%

Estimated time:
0:06 h

Description

If I add a popup menu to a navigation bar which is part of a layout the popup menu for some reason inherits the overflow of the layout which is hidden. If I manually change the CSS of the html page (via developer console) the popup menu is displayer properly. But at the point where the popup leaves the navigation bar (and would consequently need to overflow) it gets hidden.

Theoretically I would expect the menu to inherit from navbar but for some reason it is changed and inline says Overflow: hidden

As for the example code:

      auto layout = this->setLayout(std::make_unique<Wt::WVBoxLayout>());     
      setOverflow(Wt::Overflow::Visible);
      auto container_logo = layout->addWidget(std::make_unique<Wt::WContainerWidget>());
      auto navigation_ = layout->addWidget(std::make_unique<Wt::WNavigationBar>());       
      container_logo->addNew<Wt::WImage>(Wt::WLink("icons/wt_powered.jpg"));
      auto rightMenu = navigation_->addMenu(std::make_unique<Wt::WMenu>(), Wt::AlignmentFlag::Right);
      auto popupPtr = std::make_unique<Wt::WPopupMenu>();
      auto popup = popupPtr.get();
      auto item = rightMenu->addItem(std::make_unique<Wt::WMenuItem>("Profile"));
      item->setMenu(std::move(popupPtr));

      popup->addItem(name);
      //popup->addItem("logout");
      popup->addSeparator();
      popup->addItem("About")->triggered().connect([=] () {
          std::cout << "About information: \n";
          Wt::WMessageBox *aboutInfo = new Wt::WMessageBox("About Information", "<p> UserID is .</p> <p> UserName is . </p><p> UserStatus is . </p>", Wt::Icon::Information, Wt::StandardButton::Ok);
          aboutInfo->setModal(false);
          aboutInfo->buttonClicked().connect([=] (){delete aboutInfo;});
          aboutInfo->show();

          //box->setText("Test");
      });

      popup->addItem("logout")->triggered().connect([=] () {
        std::cout<< "Inside the logout function-------\n";
      });
      navigation_->addSearch(std::make_unique<Wt::WLineEdit>("Enter a search item!"), Wt::AlignmentFlag::Right);
      navigation_->addStyleClass("main-nav");
      navigation_->setTitle("<b>FPM</b>Web",
          "http://www.webtoolkit.eu/widgets");
      navigation_->setResponsive(true);
      auto contentsStack_ = layout->addWidget(std::make_unique<Wt::WStackedWidget>(),1);
      Wt::WAnimation animation(Wt::AnimationEffect::Fade,
                               Wt::TimingFunction::Linear,
                               200);
      contentsStack_->setTransitionAnimation(animation, false);
      auto menu = navigation_->addMenu(std::make_unique<Wt::WMenu>(contentsStack_));
      menu->setInternalPathEnabled();
      menu->setInternalBasePath("/");
      layout->setContentsMargins( 0  , 0, 0, 0);
Actions #1

Updated by Roel Standaert over 4 years ago

Ok, I bisected it to commit cd37d6e22d14954b83901d82d6cd904202f11746.

Actions #2

Updated by Roel Standaert over 4 years ago

Oh, actually, I tested it in the widget gallery, and bisected it to that commit because that's the commit that turns off the JavaScript implementation of layouts for the widget gallery...

Actions #3

Updated by Roel Standaert over 4 years ago

Tested it with your example too (using Bootstrap 3 theme, which I assume is also what you're using), and it's the same commit indeed.

Actions #4

Updated by Roel Standaert over 4 years ago

  • Tracker changed from Support to Bug
  • Status changed from New to Resolved

Looks like this is because the popup menu is not being reparented, and is thus affected by overflow: hidden. The wtNoReparent seems to be a relic of the past when the reparenting code wouldn't work right though. I pushed a commit removed this wtNoReparent to master. I'm not touching 4.1-release for this one, since I don't completely trust that I didn't miss a regression somewhere.

Actions #5

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF