diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index fa8343652..082eafe6f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -22,6 +22,8 @@ - **Button** - ``ui vertical basic buttons` now have dividers in default theme - **API** - Fixed bug where API would query resource immediately when specifying `on: false` - **API** - Fixed bug where `$.api('get xhr')` was not correctly returning xhr promise +- **Sidebar** - Fixed bug with `pusher` inheriting first child margins due to `margin-collapse` +- **Sidebar** - Sidebar will now only close if you click on `pusher` or underlayed `body` (scale out). Clicking on fixed elements will not close sidebar. - *Sticky** - Fixes issue with container size not being set explicitly on rail due to improper method renaming - **Search** - Search results no longer hide/show when user changes tab or page loses focus - **Transition** - Fixed bug with animations that contain the strings 'in' or 'out' as part of their names, for example "swing" diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js index 4f9457f63..bf0eefece 100644 --- a/src/definitions/modules/sidebar.js +++ b/src/definitions/modules/sidebar.js @@ -59,6 +59,7 @@ $.fn.sidebar = function(parameters) { $context = $(settings.context), $sidebars = $module.children(selector.sidebar), + $fixed = $context.children(selector.fixed), $pusher = $context.children(selector.pusher), $style, @@ -134,10 +135,18 @@ $.fn.sidebar = function(parameters) { event: { clickaway: function(event) { - if( $(event.target).closest(selector.sidebar).length === 0 ) { + var + clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)), + clickedContext = ($context.is(event.target)) + ; + if(clickedInPusher) { module.verbose('User clicked on dimmed page'); module.hide(); } + if(clickedContext) { + module.verbose('User clicked on dimmable context (scaled out page)'); + module.hide(); + } }, touch: function(event) { //event.stopPropagation(); @@ -267,7 +276,6 @@ $.fn.sidebar = function(parameters) { + ' }' ; } - style += ''; $head.append(style); $style = $('style[title=' + namespace + ']'); @@ -280,6 +288,7 @@ $.fn.sidebar = function(parameters) { $context = $(settings.context); $sidebars = $context.children(selector.sidebar); $pusher = $context.children(selector.pusher); + $fixed = $context.children(selector.fixed); }, refreshSidebars: function() {