Skip to content

Commit

Permalink
#1968 Fixes undetachable scrollable modal in ideal circumstances (not…
Browse files Browse the repository at this point in the history
… inside a container with z-index)
  • Loading branch information
jlukic committed Mar 17, 2015
1 parent af76214 commit d9850a0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
- **Grid** - Fixes colored grid columns not appearing when not nested in rows
- **Label** - Labels inside `header` now vertical align better by accounting for line height offset
- **Message** - Message now uses `@lineHeight` from `site.variables`
- **Modal** - `scrollable modal` now correctly adds padding below modal
- **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
- **Table** - `very basic table` now works together with `padded table`
- **Table** - Fix inheritance of text alignment and vertical alignment
Expand Down
15 changes: 11 additions & 4 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ $.fn.modal = function(parameters) {
module.verbose('Modal is detachable, moving content into dimmer');
$dimmable.dimmer('add content', $module);
}
else {
module.set.undetached();
}
$dimmer = $dimmable.dimmer('get dimmer');
},
id: function() {
Expand Down Expand Up @@ -580,7 +583,7 @@ $.fn.modal = function(parameters) {
else {
module.debug('Modal is taller than page content, resizing page height');
$body
.css('height', module.cache.height + (settings.padding / 2) )
.css('height', module.cache.height + (settings.padding * 2) )
;
}
},
Expand Down Expand Up @@ -621,6 +624,9 @@ $.fn.modal = function(parameters) {
})
;
}
},
undetached: function() {
$dimmable.addClass(className.undetached);
}
},

Expand Down Expand Up @@ -850,9 +856,10 @@ $.fn.modal.settings = {
notFound : 'The element you specified could not be found'
},
className : {
active : 'active',
animating : 'animating',
scrolling : 'scrolling'
active : 'active',
animating : 'animating',
scrolling : 'scrolling',
undetached : 'undetached'
}
};

Expand Down
50 changes: 35 additions & 15 deletions src/definitions/modules/modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,23 @@
}
}


/*******************************
States
*******************************/

.ui.active.modal {
display: block;
}

/*******************************
Variations
Variations
*******************************/

/*--------------
Scrolling
---------------*/

/* A modal that cannot fit on the page */
.scrolling.dimmable.dimmed {
overflow: hidden;
Expand All @@ -307,30 +320,37 @@
.scrolling.dimmable > .dimmer {
position: fixed;
}

.ui.scrolling.modal {
position: static;
.modals.dimmer .ui.scrolling.modal {
position: static !important;
margin: @scrollingMargin auto !important;
}

/* undetached scrolling */
.scrolling.undetached.dimmable.dimmed {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.scrolling.undetached.dimmable.dimmed > .dimmer {
overflow: hidden;
}
.scrolling.undetached.dimmable .ui.scrolling.modal {
position: absolute;
left: 50%;
margin-top: @scrollingMargin !important;
}

/* Coupling with Sidebar */
.undetached.dimmable.dimmed > .pusher {
z-index: auto;
}

@media only screen and (max-width : @computerBreakpoint) {
.ui.scrolling.modal {
margin-top: @mobileScrollingMargin;
margin-bottom: @mobileScrollingMargin;
}
}

/*******************************
States
*******************************/

.ui.active.modal {
display: block;
}

/*******************************
Variations
*******************************/

/*--------------
Full Screen
Expand Down

0 comments on commit d9850a0

Please sign in to comment.