Skip to content

Commit

Permalink
MDL-75957 core: Prevent repositioning dropdowns along the y-axis
Browse files Browse the repository at this point in the history
Disables filipping the dropdowns up or dynamically repositioning
them along the y-axis to prevent them getting hidden behind the
navbar or them covering the trigger element.
  • Loading branch information
Mihail Geshoski committed Oct 24, 2022
1 parent 046e48c commit fce11bf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion theme/boost/amd/build/loader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion theme/boost/amd/build/loader.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 27 additions & 2 deletions theme/boost/amd/src/loader.js
Expand Up @@ -104,8 +104,33 @@ enablePopovers();
// Enable all tooltips.
enableTooltips();

// Disables flipping the dropdowns up and getting hidden behind the navbar.
$.fn.dropdown.Constructor.Default.flip = false;
// Disables flipping the dropdowns up or dynamically repositioning them along the Y-axis (based on the viewport)
// to prevent the dropdowns getting hidden behind the navbar or them covering the trigger element.
$.fn.dropdown.Constructor.Default.popperConfig = {
modifiers: {
flip: {
enabled: false,
},
storeTopPosition: {
enabled: true,
// eslint-disable-next-line no-unused-vars
fn(data, options) {
data.storedTop = data.offsets.popper.top;
return data;
},
order: 299
},
restoreTopPosition: {
enabled: true,
// eslint-disable-next-line no-unused-vars
fn(data, options) {
data.offsets.popper.top = data.storedTop;
return data;
},
order: 301
}
},
};

pendingPromise.resolve();

Expand Down

0 comments on commit fce11bf

Please sign in to comment.