From d0b451290b49e3691bc0df372444debea4c1cea3 Mon Sep 17 00:00:00 2001 From: jlukic Date: Wed, 8 Apr 2015 14:39:00 -0400 Subject: [PATCH] Popup will not appear on hidden elements --- RELEASE-NOTES.md | 1 + src/definitions/modules/popup.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2607be0ba..66c2a82b1 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -119,6 +119,7 @@ - **Modal** - Modal with `detachable: false` inside `ui sidebar` `pusher` element will now show correctly - **Popup** - Fixes issue with `min-width` in firefox exceeding `max-width` causing element to not wrap correctly - **Popup** - Popup will now produce an error message and not mistakenly appear in the top left corner of page, if called with a `popup` or `target` that does not exist. +- **Popup** - Popup will no longer appear incorrectly if the targeted element is not visible on page - **Popup** - Fixed bug which could cause pre-existing inline popup to be removed from DOM after hiding - **Reveal** - Removed `masked` reveal, all reveals are masked by default - **Search** - Search will no longer incorrectly produce an error when API settings are passed through metadata diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index f0002714c..eb055ae97 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -604,7 +604,6 @@ $.fn.popup = function(parameters) { module.error(error.notFound); return; } - var windowWidth = $(window).width(), windowHeight = $(window).height(), @@ -642,6 +641,11 @@ $.fn.popup = function(parameters) { position = position || $module.data(metadata.position) || settings.position; arrowOffset = arrowOffset || $module.data(metadata.offset) || settings.offset; + if(target.top == 0 && target.left == 0) { + module.debug('Popup target is hidden, no action taken'); + return false; + } + if(searchDepth == settings.maxSearchDepth && settings.lastResort) { module.debug('Using last resort position to display', settings.lastResort); position = settings.lastResort;