forked from mirror/Part-DB.Part-DB-server
Use strategy fixed for dropdown menus, so they dont get clipped by an overflow: hidden
This fixes issue #209
This commit is contained in:
parent
4a8480edce
commit
f1c3a52c8a
1 changed files with 17 additions and 2 deletions
|
@ -19,15 +19,17 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import {Dropdown} from "bootstrap";
|
||||||
|
|
||||||
class RegisterEventHelper {
|
class RegisterEventHelper {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.registerTooltips();
|
this.registerTooltips();
|
||||||
|
this.configureDropdowns();
|
||||||
this.registerSpecialCharInput();
|
this.registerSpecialCharInput();
|
||||||
|
|
||||||
this.registerModalDropRemovalOnFormSubmit()
|
this.registerModalDropRemovalOnFormSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
registerModalDropRemovalOnFormSubmit() {
|
registerModalDropRemovalOnFormSubmit() {
|
||||||
//Remove all modal backdrops, before rendering the new page.
|
//Remove all modal backdrops, before rendering the new page.
|
||||||
document.addEventListener('turbo:before-render', event => {
|
document.addEventListener('turbo:before-render', event => {
|
||||||
|
@ -40,6 +42,19 @@ class RegisterEventHelper {
|
||||||
document.addEventListener('turbo:load', fn);
|
document.addEventListener('turbo:load', fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureDropdowns() {
|
||||||
|
this.registerLoadHandler(() => {
|
||||||
|
//Set the dropdown strategy to fixed, so that the dropdowns are not cut off by the overflow: hidden of the body.
|
||||||
|
//Solution from: https://github.com/twbs/bootstrap/issues/36560
|
||||||
|
const dropdowns = document.querySelectorAll('[data-bs-toggle="dropdown"]');
|
||||||
|
const dropdown = [...dropdowns].map((dropdownToggleEl) => new Dropdown(dropdownToggleEl, {
|
||||||
|
popperConfig(defaultBsPopperConfig) {
|
||||||
|
return { ...defaultBsPopperConfig, strategy: 'fixed' };
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
registerTooltips() {
|
registerTooltips() {
|
||||||
this.registerLoadHandler(() => {
|
this.registerLoadHandler(() => {
|
||||||
$(".tooltip").remove();
|
$(".tooltip").remove();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue