Bug #12284
openWMenuItem sets its label text as a pathComponent
0%
Description
So I tried to create a navbar for my application and followed instructions from widget gallery
leftMenu_->addItem("Layout", std::make_unique<Wt::WText>("Layout contents"))
->setLink(Wt::WLink(Wt::LinkType::InternalPath, "/layout"));
When menu items created like above, no matter what link was set by setLink() - internal paths of your application will be broken.
As seen here, any WMenuItem will set its pathComponent from text provided for label. I don't think it is a good idea to do this by default.
When I pass some non-latin string (cyrillic in my case), when it cannot be translated, all characters will be replaced with _ .
And when I click menu items, I will see in browser location bar something like http://localhost/my-app/___ instead of http://localhost/my-app/layout . Even if I enter a correct link, it will be replaced with pathComponent.
Working solution for me is to use setPathComponent() instead of setlink(), but I still getting warnings like this:
[warning] "WString: narrow(): loss of detail: ???????
No data to display