Browse Source

#1687 Clicking on fixed elements no longer closes sidebar

pull/1698/merge
jlukic 9 years ago
parent
commit
d5d0a25069
2 changed files with 13 additions and 2 deletions
  1. 2
      RELEASE-NOTES.md
  2. 13
      src/definitions/modules/sidebar.js

2
RELEASE-NOTES.md

@ -22,6 +22,8 @@
- **Button** - ``ui vertical basic buttons` now have dividers in default theme - **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 would query resource immediately when specifying `on: false`
- **API** - Fixed bug where `$.api('get xhr')` was not correctly returning xhr promise - **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 - *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 - **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" - **Transition** - Fixed bug with animations that contain the strings 'in' or 'out' as part of their names, for example "swing"

13
src/definitions/modules/sidebar.js

@ -59,6 +59,7 @@ $.fn.sidebar = function(parameters) {
$context = $(settings.context), $context = $(settings.context),
$sidebars = $module.children(selector.sidebar), $sidebars = $module.children(selector.sidebar),
$fixed = $context.children(selector.fixed),
$pusher = $context.children(selector.pusher), $pusher = $context.children(selector.pusher),
$style, $style,
@ -134,10 +135,18 @@ $.fn.sidebar = function(parameters) {
event: { event: {
clickaway: function(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.verbose('User clicked on dimmed page');
module.hide(); module.hide();
} }
if(clickedContext) {
module.verbose('User clicked on dimmable context (scaled out page)');
module.hide();
}
}, },
touch: function(event) { touch: function(event) {
//event.stopPropagation(); //event.stopPropagation();
@ -267,7 +276,6 @@ $.fn.sidebar = function(parameters) {
+ ' }' + ' }'
; ;
} }
style += '</style>'; style += '</style>';
$head.append(style); $head.append(style);
$style = $('style[title=' + namespace + ']'); $style = $('style[title=' + namespace + ']');
@ -280,6 +288,7 @@ $.fn.sidebar = function(parameters) {
$context = $(settings.context); $context = $(settings.context);
$sidebars = $context.children(selector.sidebar); $sidebars = $context.children(selector.sidebar);
$pusher = $context.children(selector.pusher); $pusher = $context.children(selector.pusher);
$fixed = $context.children(selector.fixed);
}, },
refreshSidebars: function() { refreshSidebars: function() {

Loading…
Cancel
Save