mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
fix(backdrop): blocks scrolling in standalone
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
ion-action-sheet {
|
ion-action-sheet {
|
||||||
@include position(0, null, null, 0);
|
@include position(0, null, null, 0);
|
||||||
|
|
||||||
position: absolute;
|
position: fixed;
|
||||||
z-index: $z-index-overlay;
|
z-index: $z-index-overlay;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
ion-alert {
|
ion-alert {
|
||||||
@include position(0, 0, 0, 0);
|
@include position(0, 0, 0, 0);
|
||||||
|
|
||||||
position: absolute;
|
position: fixed;
|
||||||
|
|
||||||
z-index: $z-index-overlay;
|
z-index: $z-index-overlay;
|
||||||
|
|
||||||
@ -61,6 +61,8 @@ ion-alert.alert-top {
|
|||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
overscroll-behavior-y: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-input {
|
.alert-input {
|
||||||
|
@ -342,6 +342,7 @@ export class Alert {
|
|||||||
const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'alert-translucent') : {};
|
const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'alert-translucent') : {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
role: 'alertdialog',
|
||||||
class: {
|
class: {
|
||||||
...themedClasses,
|
...themedClasses,
|
||||||
...getClassMap(this.cssClass)
|
...getClassMap(this.cssClass)
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<title>Alert - Standalone</title>
|
<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">
|
<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>
|
<script src="/dist/ionic.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -19,9 +20,44 @@
|
|||||||
<button id="checkbox" onclick="presentAlertCheckbox()">Checkbox</button>
|
<button id="checkbox" onclick="presentAlertCheckbox()">Checkbox</button>
|
||||||
<button onclick="presentWithCssClass()">CssClass</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>
|
<ion-alert-controller></ion-alert-controller>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.f {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
background: blue;
|
||||||
|
margin: 20px auto;
|
||||||
|
}
|
||||||
|
|
||||||
body > button {
|
body > button {
|
||||||
display: block;
|
display: block;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
@ -52,6 +52,8 @@ body {
|
|||||||
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
overscroll-behavior-y: contain;
|
||||||
|
|
||||||
text-size-adjust: none;
|
text-size-adjust: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
@ -29,3 +29,7 @@ ion-backdrop {
|
|||||||
cursor: auto;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.backdrop-no-scroll {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
@ -21,6 +21,14 @@ export class Backdrop {
|
|||||||
|
|
||||||
@Event() ionBackdropTap: EventEmitter;
|
@Event() ionBackdropTap: EventEmitter;
|
||||||
|
|
||||||
|
componentDidLoad() {
|
||||||
|
registerBackdrop(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUnload() {
|
||||||
|
unregisterBackdrop(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Listen('touchstart', {passive: false, capture: true})
|
@Listen('touchstart', {passive: false, capture: true})
|
||||||
protected onTouchStart(ev: TouchEvent) {
|
protected onTouchStart(ev: TouchEvent) {
|
||||||
this.lastClick = now(ev);
|
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 {
|
ion-loading {
|
||||||
@include position(0, 0, 0, 0);
|
@include position(0, 0, 0, 0);
|
||||||
|
|
||||||
position: absolute;
|
position: fixed;
|
||||||
z-index: $z-index-overlay;
|
z-index: $z-index-overlay;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Reference in New Issue
Block a user