Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upBig dropdowns are unusable when used inside an `overflow:scroll` container, due to being constrained inside it #24251
Comments
This comment has been minimized.
This comment has been minimized.
|
Try this:
I use this for table responsive. |
This comment has been minimized.
This comment has been minimized.
|
@danijelGombac works in the jsFiddle, thanks Still looks like desirable-by default behavior to me, so leaving the issue open. |
This comment has been minimized.
This comment has been minimized.
|
Curious if this is doable with Popper @Johann-S? Previously we have been constrained by the manual placement of dropdowns in the DOM. |
This comment has been minimized.
This comment has been minimized.
|
Yep we can add a |
This comment has been minimized.
This comment has been minimized.
@Johann-S @mdo thanks for the fast feedback
@tmorehouse anything to comment on that |
This comment has been minimized.
This comment has been minimized.
|
@ronjouch regarding b-popover/b-tooltips, dynamically creatd new DOM elements are appended to the DOM (body by default, or the optional container) when the tip/popover opens. b-dropdown is different in that reactive content (i.e. the dropdown items which most likely have event listeners) are created by components outside of the dropdown component scope (even through they are children) We could try a re-parenting option, but it would require a new "dumb" wrapper element around the |
This comment has been minimized.
This comment has been minimized.
|
An usually unknown behavior of DOM and CSS is that an
The only situation when an
This behavior can be leveraged to make a popper overflow its scrolling parent.
In our specific case, the
|
This comment has been minimized.
This comment has been minimized.
|
@FezVrasta this appears to be a bit buggy in Firefox, and doesn't handle when the dropdown is wider than the container. It is still partially off screen. |
This comment has been minimized.
This comment has been minimized.
|
@tmorehouse the problem with col-2 is because Popper.js is not yet optimized for this use case. About Firefox, it looks like it's only the If this approach is something that Bootstrap wants to adopt I can work on Popper.js to make it work better to fit this need. |
This comment has been minimized.
This comment has been minimized.
|
@FezVrasta, @Johann-S @mdo @ronjouch For Bootstrap-Vue we have just added an option (via PR bootstrap-vue/bootstrap-vue#1440) to change the Popper.js reference: https://popper.js.org/popper-documentation.html#modifiers..preventOverflow This appears to work well from our tests so far, while still preserving the default behavior when scrollParent is set as the Before (with Now (with the Which renders the following if <div class="dropdown" style="position: static">
<button class="dropdown-toggle">Dropdown</button>
<div class="dropdown-menu">
<!-- dropdown items here -->
</div>
</div> |
This comment has been minimized.
This comment has been minimized.
|
seems nice @tmorehouse I'll give it a look |
This comment has been minimized.
This comment has been minimized.
|
@Johann-S We have also done something similar for popover/tooltip (without the use of Basically we have added a |
This comment has been minimized.
This comment has been minimized.
Overflow scroll elements doesn't play well with overflowing children with position anything but static: twbs/bootstrap#24251 Fix by padding with spacer div since user switcher has a known maximum height.
Overflow scroll elements doesn't play well with overflowing children with position anything but static: twbs/bootstrap#24251 Fix by padding with spacer div since user switcher has a known maximum height.
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes #37594
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
X-original-commit: c3273b7
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
X-original-commit: c3273b7
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
X-original-commit: c3273b7
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes #38069
X-original-commit: c3273b7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes #38057
X-original-commit: c3273b7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes #38080
X-original-commit: c3273b7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes #38069
X-original-commit: c3273b7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Open a search view modal ("search more" on a m2o)
Select a filter that will make records fall to zero
The modal will shrink
Trigger the opening of a dropdown (Filters), and make sure
that there are many many menu items there (many filters)
Before this commit, the dropdown was bigger than the modal
which had a scroll bar,
however, the dropdown itself was not scrollable properly
So, clicking in it to select a menu item will fail when scrolled
all the way down, because elements did not actually followed the scroll
After this commit, the dropdown follows the scroll, and it is possible
to use it even way down
We use a behavior of bootstrap 4 itself:
FIX: twbs/bootstrap#24976
ISSUE: twbs/bootstrap#24251
OPW 2076337
closes odoo#38080
X-original-commit: c3273b7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>






Problem
When using a Bootstrap (4.0.0beta) Dropdown in an element that is a child of an
overflow:scrollelement, the dropdown is "stuck" inside the container, making it unusable if the dropdown contents are too big horizontally/vertically:Contrarily, a vanilla HTML

<select>will merrily bleed out of theoverflow:scrollelement as necessary:See demo at JSFiddle/ronj/t6z6Lnfb.
Use case
A few words on the use case justifying this combination, as shown in the JSFiddle which mimics a webapp I'm working on:
overflow-y:scrolldiv. Each filter has a dropdown which lets users modify filter options.→ As a user,
overflow-y:scrollsidebar scrolling behavior (because the list of filters is of undetermined and potentially large height, depending on the number of filters)And as shown in the demo/screenshots, vanilla HTML
<select>don't suffer from this problem, but it's not always practical/possible to revert back to using them, e.g. due to using features specific to Bootstrap Dropdown, or for consistent styling.Details
Bootstrap version: 4.0.0-beta
OS/Browser: Ubuntu 16.04.3 / {Chrome 63, Firefox 58}
This issue is a follow-up to SO / Letting a bootstrap
b-dropdownescape out of anoverflow:scrollcontainer, but noticing regular<select>are not affected, it starts to look like a bug, thus this issue. Sorry for the noise if I'm missing something obvious / if there's a workaround / if this is a known problem tracked in an existing issue.Thanks🙂 .