Steps to reproduce:
- Use Firefox (don't know whether this is a necessary step).
- Go to a page that is short enough to display without scrollbars (Special:BlankPage will probably do).
- Execute the following code:
mw.loader.using('oojs-ui').done(function () { function MyPage () { var fieldsetLayout, dropdownWidget; MyPage.parent.apply(this, arguments); dropdownWidget = new OO.ui.DropdownWidget({ $overlay: $('body'), menu: { items: [ new OO.ui.MenuOptionWidget({label: 'a'}), new OO.ui.MenuOptionWidget({label: 'b'}), new OO.ui.MenuOptionWidget({label: 'c'}) ] } }); fieldsetLayout = new OO.ui.FieldsetLayout({label: 'Foo'}); fieldsetLayout.addItems([new OO.ui.FieldLayout(dropdownWidget, {label: 'Bar', align: 'left'})]) this.$element.append( $('<p>').height(300), fieldsetLayout.$element, $('<p>').height(900) ); } OO.inheritClass(MyPage, OO.ui.PageLayout); var booklet, panel; booklet = new OO.ui.BookletLayout({continuous: true}); booklet.addPages([new MyPage('x', 'Title')]); panel = new OO.ui.PanelLayout({ content: [booklet], expanded: false, framed: true }); var $content = $('#bodyContent'), $panel = panel.$element; $content.empty().append($panel.height(300)); function resize () { $panel.height(Math.max( $(window).height() - $content.offset().top - $panel.offset().top, 400 )); } $(window).on('resize', resize); resize(); });
- Note that the page still doesn't have a scrollbar (if it has one, then adapt the sizes in the above code to fit your screen).
- Open the dropdown.
Expected: The menu should be exactly below it.
Actual: It's a few pixels (width of a scrollbar?) too far left, the total width is correct.
Note that:
- When you resize the window while the dropdown is open to a size with scrollbars (e.g. by opening the browser console), the menu is positioned correctly, but it is too wide.
- When the page has a scrollbar and you open the dropdown, it is positioned correctly and has the correct width.
- I can't reproduce the issue without the FieldsetLayout, adding the DropdownWidget directly to the page seems to work.
- Depending on your version you might run into T157936: Menu of DropdownWidget gets separated on scrolling inside continuous BookletLayout with this code.