mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(backdrop): blocks scrolling in standalone
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
ion-action-sheet {
|
||||
@include position(0, null, null, 0);
|
||||
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
z-index: $z-index-overlay;
|
||||
display: block;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
ion-alert {
|
||||
@include position(0, 0, 0, 0);
|
||||
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
|
||||
z-index: $z-index-overlay;
|
||||
|
||||
@ -61,6 +61,8 @@ ion-alert.alert-top {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
overflow-y: scroll;
|
||||
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
|
||||
.alert-input {
|
||||
|
@ -342,6 +342,7 @@ export class Alert {
|
||||
const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'alert-translucent') : {};
|
||||
|
||||
return {
|
||||
role: 'alertdialog',
|
||||
class: {
|
||||
...themedClasses,
|
||||
...getClassMap(this.cssClass)
|
||||
|
@ -6,6 +6,7 @@
|
||||
<title>Alert - Standalone</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<script src="/dist/ionic.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -19,9 +20,44 @@
|
||||
<button id="checkbox" onclick="presentAlertCheckbox()">Checkbox</button>
|
||||
<button onclick="presentWithCssClass()">CssClass</button>
|
||||
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
<div class="f"></div>
|
||||
|
||||
<dialog id="favDialog">
|
||||
<form method="dialog">
|
||||
<section>
|
||||
<p><label for="favAnimal">Favorite animal:</label>
|
||||
<select id="favAnimal">
|
||||
<option></option>
|
||||
<option>Brine shrimp</option>
|
||||
<option>Red panda</option>
|
||||
<option>Spider monkey</option>
|
||||
</select></p>
|
||||
</section>
|
||||
<menu>
|
||||
<button id="cancel" type="reset">Cancel</button>
|
||||
<button type="submit">Confirm</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
<ion-alert-controller></ion-alert-controller>
|
||||
|
||||
<style>
|
||||
.f {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
body > button {
|
||||
display: block;
|
||||
clear: both;
|
||||
|
@ -52,6 +52,8 @@ body {
|
||||
|
||||
word-wrap: break-word;
|
||||
|
||||
overscroll-behavior-y: contain;
|
||||
|
||||
text-size-adjust: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
@ -29,3 +29,7 @@ ion-backdrop {
|
||||
cursor: auto;
|
||||
}
|
||||
}
|
||||
|
||||
body.backdrop-no-scroll {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
@ -21,6 +21,14 @@ export class Backdrop {
|
||||
|
||||
@Event() ionBackdropTap: EventEmitter;
|
||||
|
||||
componentDidLoad() {
|
||||
registerBackdrop(this);
|
||||
}
|
||||
|
||||
componentDidUnload() {
|
||||
unregisterBackdrop(this);
|
||||
}
|
||||
|
||||
@Listen('touchstart', {passive: false, capture: true})
|
||||
protected onTouchStart(ev: TouchEvent) {
|
||||
this.lastClick = now(ev);
|
||||
@ -53,3 +61,18 @@ export class Backdrop {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const BACKDROP_NO_SCROLL = 'backdrop-no-scroll';
|
||||
const activeBackdrops = new Set();
|
||||
|
||||
function registerBackdrop(backdrop: any) {
|
||||
activeBackdrops.add(backdrop);
|
||||
document.body.classList.add(BACKDROP_NO_SCROLL);
|
||||
}
|
||||
|
||||
function unregisterBackdrop(backdrop: any) {
|
||||
activeBackdrops.delete(backdrop);
|
||||
if(activeBackdrops.size === 0) {
|
||||
document.body.classList.remove(BACKDROP_NO_SCROLL);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
ion-loading {
|
||||
@include position(0, 0, 0, 0);
|
||||
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
z-index: $z-index-overlay;
|
||||
|
||||
display: flex;
|
||||
|
Reference in New Issue
Block a user