Bug #11345

WStackedWidget in flex or javascript layouts can lose vertical scrollbar on animated transitions

Added by Bruce Toll about 1 month ago. Updated about 1 month ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


With wt 4.9.1, a WStackedWidget in a layout can lose vertical scrollbars on animated transitions. This occurs with both flex and javascript layout implementations.

The attached test program demonstrates the issue. You can choose an animation and then switch between layers using the radio buttons. The application displays two WStackedWidgets. One is in a Flex layout, the other is in a JavaScript layout. The "No Animation" case should work fine with both layouts in 4.9.1, but will lose vertical scrollbars with the animations.

As a note, the Flex layout will appear to work correctly if you visit the layers with the "No Animation" case before trying the animated cases. That's because a height will be set as a side-effect of visiting the layers.
Also, the javascript case will appear to work initially in some cases, but will fail on subsequent transitions.

I've attached two patches for your review, which I believe help with both cases. The first appears sufficient to fix layouts with the javascript implementation. The second addresses flex layouts.

This is largely a follow-up to #7082 with an improved example program, an updated patch for the javascript implementation and a new patch for the flex implementation. Testing was done with Wt-4.9.1. I also re-tested with the wt-homepage example and there appear to be no regressions. See #6788 for the test procedure.



Updated by Bruce Toll about 1 month ago

I had previously assumed that WStackedWidget animations with scrollbars worked correctly when a WStackedWidget was used outside of a layout. However, that does not appear to be the case. I've attached an updated test program which adds two test cases with WStackedWidgets that are not in a layout -- one has a fixed size and the other is auto.

I also attached a third patch to apply after the above two in order to address the case where there is a set size on a WStackedWidget, but it is not in a layout. The cases in the updated test program seem to work fine with the three patches, as does the wt-homepage example. The patches would definitely benefit from additional review.

As a workaround, one can also disable animation on WStackedWidgets where scrollbars are required.


Updated by Bruce Toll about 1 month ago

Additional notes:

  • The first example in with auto size in file test_WStackedWidget_animation_overflow_20230222a.C is meant to help spot regressions, but looks different from the others and can be commented out (line 34).
  • I did most testing with Firefox using the "Always show scrollbars" setting. The most recent testing was with Firefox version 110.0.

Also available in: Atom PDF