Bug #1802
closedWPushButton for URL fails with WBootstrapTheme when button is initially hidden (and rendered) prior to setLInk
0%
Description
When using the new 3.3.0 BootstrapTheme, if you create a hidden WPushButton without a setLink and then subsequently display the WPushButton after a setLink, it is rendered as a non-functional button --- rather than an anchor.
I'm not sure if this is intended as a valid use case, but a similar sequence works with the "default" and "polished" themes.
Attached is a small test program that demonstrates the problem. By default, it will demonstrate the issue. Just click on the button "Click here for options" to get a non-functional button labeled "Click for external link".
With a URL parameter of "polished" or "default", the test program demonstrates the working button behavior provided by the "default" and "polished" themes, respectively.
With a URL parameter of "workaround" the test program does a setLink(Wlink("/")) on the WPushButton when it is initially created. The WPushButton then works as expected when it subsequently has its link updated and is unhidden.
Hope this helps. Thanks for all the great work on Wt!
Files
Updated by Bruce Toll over 11 years ago
Tested Wt version was from github (git describe ---tags => 3.3.0-rc4-1-g9536c9f)
Updated by Koen Deforche over 11 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.1
Hey Bruce,
Indeed this will fail. In bootstrap we actually can switch to an anchor as implementation because visually the button is entirely guided by CSS, but this is not the case in the default CSS theme (although it could be done in polished, I guess).
What should happen is that the button is rerendered as an anchor. This shouldn't be too hard, so I'ld like to solve this for 3.3.1
Regards,
koen
Updated by Bruce Toll over 11 years ago
Hi Ken,
Thanks for the clear explanation and rapid resolution of the other issues reported.
Regards,
Bruce
Updated by Koen Deforche over 11 years ago
- Target version deleted (
3.3.1)
This is harder than expected --- in fact, I wonder whether it's worth the trouble since workarounds are easily done (e.g. recreating the widget).
Updated by Bruce Toll over 11 years ago
Hi Koen,
Thanks for following-up on this. I agree that the workaround is fine --- and a developer should find the problem in testing.
Perhaps a note could be added to the setLink() method with the limitation/workaround. If it's easy to implement, it might even be worth logging a warning, e.g. "WPushButton::setLink Cannot use setLink to set external URL on WPushButton after render with this theme. See documentation."
---Bruce
Updated by Koen Deforche almost 11 years ago
- Status changed from InProgress to Resolved
- Target version set to 3.3.2
Hey Bruce,
Good idea, the note. We've added it.
Regards,
koen
Updated by Koen Deforche almost 11 years ago
- Status changed from Resolved to Closed