Project

General

Profile

Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox

Added by Paul de Wit over 6 years ago

I have the following page layout:

+---------------------+
|       top row       |
+---------------------+
| menu | page content |
+---------------------+
|     bottom  row     |
+---------------------+

With the following hierarchy:

root
  WContainerWidget ('framework')
    WHBoxLayout ('top row', with a few text widgets)
    WHBoxLayout ('middle row')
      WContainerWidget ('btns')
        WVBoxLayout (with some WPushButton widgets)
      WStackedWidget ('page content')
        4 x WContainerWidgets, each with some widgets
    WHBoxLayout ('bottom row' with a text widget)

Height is set via CSS to 100% on the html and body elements, and on the framework container. Stretch is set on the middle row layout to give the stackwidget the available space. Height is also set to 100% on the containers that are added to the stackedwidget, so that they fill all 'page content' space.

Now, the following is the problem:

One of the container widgets that was added to the stacked widget contains a text that is too long to fit in the available space. Via CSS I set the "overflow: auto" on the 'page content' widget to enable vertical scrolling. In Chrome v60 and IE v11 this works as expected. However, Firefox (v55) displays a scrollbar for the full page and not for the area of the stacked widget.

A search on internet showed that 'Flex items establish a default minimum size that's based on their children's intrinsic size (which doesn't consider "overflow" properties on their children/descendants)':

https://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox

A (or the?) solution is to explicitly set min-height:0 on the middle row HBoxLayout. Wt however generates a

with random id for the 'middle row' HBoxLayout box, it seems not possible to set the min-height property on it, also not via C.

Propbably Wt should set the min-height property automatically, or it should provide access to these properties via C or CSS. Or is there something else I can do to make the layout work?


Replies (8)

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Hyeoni Hwasoo over 6 years ago

I had the same problem. I wanted to use flex instead javascript for layout but it failed to manage correctly the overflow with firefox. So i set setPreferredImplementation(Javascript) for all my layout (a mix was a mess ...). It's a pity because flexbox are far more efficient.

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Roel Standaert over 6 years ago

I'll take a look at your workaround when I find the time. In the meantime you can use setPreferredImplementation() to change the implementation to JavaScript. This problem is the main reason for the setPreferredImplementation() method. Flexbox is indeed not a silver bullet for layouts. I hope that grids are a bit better, but I haven't looked into those in detail yet.

In general, the recommended way to design your Wt application is to use WTemplate and CSS rather than WLayout, which is the way we generally create applications these days. Of course, using layouts can be convenient, especially when coming from desktop GUI design.

Regards,

Roel

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Paul de Wit over 6 years ago

Thanks Roel, that would be great.

Is it possible to set setPreferredImplementation() to Javascript as default for all layout managers?

I was hoping we don't have to layout with CSS ourselves because of the many differences between browsers, browser versions and CSS versions.

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Roel Standaert over 6 years ago

The preferred layout implementation can not be set globally at the moment, but that may be something worth considering.

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Trigve Siver over 5 years ago

I'm hit with this bug, too, using 4.0.4.

Would it be somehow fixed or I should use the JavaScript implementation?

Thank You

RE: Wt 4.0.0-rc2: Stacked widget with container+overflow does not show scrollbars in Firefox - Added by Roel Standaert over 5 years ago

What's it like with the latest git version? A bunch has changed to the flex layout implementation since the Wt 4.0.4 release.

    (1-8/8)