Skip to content

Commit

Permalink
fix(popover): content sizing, scoped css
Browse files Browse the repository at this point in the history
fixes #15237
fixes #15589
fixes #15331
  • Loading branch information
manucorporat committed Sep 14, 2018
1 parent ca58664 commit 51d4e08
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
7 changes: 7 additions & 0 deletions core/src/components/content/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,10 @@
.overscroll::after {
top: -1px;
}

:host(.content-sizing) {
contain: none;
}
:host(.content-sizing) .inner-scroll {
position: relative;
}
3 changes: 2 additions & 1 deletion core/src/components/content/content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Element, Event, EventEmitter, Listen, Method, Prop, QueueApi } from '@stencil/core';

import { Color, Config, Mode, ScrollBaseDetail, ScrollDetail } from '../../interface';
import { createColorClasses } from '../../utils/theme';
import { createColorClasses, hostContext } from '../../utils/theme';

@Component({
tag: 'ion-content',
Expand Down Expand Up @@ -272,6 +272,7 @@ export class Content {
return {
class: {
...createColorClasses(this.color),
'content-sizing': hostContext('ion-popover', this.el),
'overscroll': this.forceOverscroll,
},
style: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ComponentRef, OverlayController, PopoverOptions } from '../../interface
import { createOverlay, dismissOverlay, getOverlay } from '../../utils/overlays';

@Component({
tag: 'ion-popover-controller'
tag: 'ion-popover-controller',
})
export class PopoverController implements OverlayController {

Expand Down
5 changes: 2 additions & 3 deletions core/src/components/popover/animations/ios.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export function iosEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev
const bodyHeight = window.innerHeight;

// If ev was passed, use that for target element
const targetDim =
ev && ev.target && (ev.target as HTMLElement).getBoundingClientRect();
const targetDim = ev && ev.target && (ev.target as HTMLElement).getBoundingClientRect();

const targetTop =
targetDim != null && 'top' in targetDim
Expand All @@ -34,7 +33,7 @@ export function iosEnterAnimation(AnimationC: Animation, baseEl: HTMLElement, ev
const arrowWidth = arrowDim.width;
const arrowHeight = arrowDim.height;

if (targetDim != null) {
if (targetDim == null) {
arrowEl.style.display = 'none';
}

Expand Down
14 changes: 7 additions & 7 deletions core/src/components/popover/popover.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// iOS Popover
// --------------------------------------------------

.popover-ios .popover-content {
.popover-content {
@include border-radius($popover-ios-border-radius);

width: $popover-ios-width;
Expand All @@ -20,7 +20,7 @@
// Popover Arrow
// -----------------------------------------

.popover-ios .popover-arrow {
.popover-arrow {
display: block;
position: absolute;

Expand All @@ -30,7 +30,7 @@
overflow: hidden;
}

.popover-ios .popover-arrow::after {
.popover-arrow::after {
@include position(3px, null, null, 3px);
@include border-radius(3px);

Expand All @@ -47,20 +47,20 @@
z-index: $z-index-overlay-wrapper;
}

.popover-ios.popover-bottom .popover-arrow {
:host(.popover-bottom) .popover-arrow {
top: auto;
bottom: -10px;
}

.popover-ios.popover-bottom .popover-arrow::after {
:host(.popover-bottom) .popover-arrow::after {
top: -6px;
}

// Translucent Popover
// -----------------------------------------

.popover-translucent-ios .popover-content,
.popover-translucent-ios .popover-arrow::after {
:host(.popover-translucent) .popover-content,
:host(.popover-translucent) .popover-arrow::after {
background: $popover-ios-translucent-background-color;
backdrop-filter: $popover-ios-translucent-filter;
}
4 changes: 2 additions & 2 deletions core/src/components/popover/popover.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Material Design Popover
// --------------------------------------------------

.popover-md .popover-content {
.popover-content {
@include border-radius($popover-md-border-radius);
@include transform-origin(start, top);

Expand All @@ -19,7 +19,7 @@
box-shadow: $popover-md-box-shadow;
}

.popover-md .popover-viewport {
.popover-viewport {
// opacity: 0;
transition-delay: 100ms;
}
8 changes: 1 addition & 7 deletions core/src/components/popover/popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Popover
// --------------------------------------------------

ion-popover {
:host {
@include position(0, 0, 0, 0);

display: flex;
Expand All @@ -29,9 +29,3 @@ ion-popover {
overflow: auto;
z-index: $z-index-overlay-wrapper;
}

.popover-content ion-content {
position: relative;

contain: none;
}
8 changes: 4 additions & 4 deletions core/src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { mdLeaveAnimation } from './animations/md.leave';
styleUrls: {
ios: 'popover.ios.scss',
md: 'popover.md.scss'
}
},
scoped: true
})
export class Popover implements OverlayInterface {

Expand Down Expand Up @@ -212,17 +213,16 @@ export class Popover implements OverlayInterface {
}

hostData() {
const themedClasses = this.translucent ? createThemedClasses(this.mode, 'popover-translucent') : {};

return {
style: {
zIndex: 20000 + this.overlayIndex,
},
'no-router': true,
class: {
...createThemedClasses(this.mode, 'popover'),
'popover-translucent': this.translucent,

...getClassMap(this.cssClass),
...themedClasses,
}
};
}
Expand Down

0 comments on commit 51d4e08

Please sign in to comment.