Skip to content

Commit

Permalink
feat(popup): add optional setting 'forcePosition' to disable calculation
Browse files Browse the repository at this point in the history
This PR adds a new optional setting forcePosition (default false to stay backward compatible) to the popup module.
Before this PR the popup module always tries to recalculate a given position setting, in case the popup wouldn't be completely visible. if now forcePosition: true is used, the position setting will definately be used, regardless if it's completely shown or cropped. This could help in situations for the calendar module because the (non-inline) calendar is a popup itself and disturbs wanted UI behavior.

Closes #684
  • Loading branch information
lubber-de authored and Sean committed Jul 25, 2019
1 parent 04109b2 commit e103541
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ $.fn.popup = function(parameters) {
// see if any boundaries are surpassed with this tentative position
distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);

if( module.is.offstage(distanceFromBoundary, position) ) {
if(!settings.forcePosition && module.is.offstage(distanceFromBoundary, position) ) {
module.debug('Position is outside viewport', position);
if(searchDepth < settings.maxSearchDepth) {
searchDepth++;
Expand Down Expand Up @@ -1376,6 +1376,9 @@ $.fn.popup.settings = {
// default position relative to element
position : 'top left',

// if given position should be used regardless if popup fits
forcePosition : false,

// name of variation to use
variation : '',

Expand Down

0 comments on commit e103541

Please sign in to comment.