Skip to content

Commit c365c92

Browse files
committed
fix(alert): add padding under the alert title for iOS when there is no message
closes #5299
1 parent 0d47a1b commit c365c92

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

ionic/components/alert/alert.ios.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ ion-alert {
9494
text-align: $alert-ios-message-text-align;
9595
}
9696

97+
.alert-message {
98+
&:empty {
99+
padding: 0 0 12px 0;
100+
}
101+
}
102+
97103

98104
// iOS Alert Input
99105
// --------------------------------------------------

ionic/components/alert/alert.md.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ $alert-md-buttons-justify-content: flex-end !default;
6969

7070
.alert-message {
7171
font-size: $alert-md-message-font-size;
72+
73+
&:empty {
74+
padding: 0;
75+
}
7276
}
7377

7478

ionic/components/alert/alert.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ ion-alert {
5252

5353
.alert-message {
5454
overflow: auto;
55-
56-
&:empty {
57-
padding: 0;
58-
}
5955
}
6056

6157
.alert-input {

ionic/components/alert/alert.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export class Alert extends ViewController {
248248
'<h2 id="{{hdrId}}" class="alert-title" *ngIf="d.title" [innerHTML]="d.title"></h2>' +
249249
'<h3 id="{{subHdrId}}" class="alert-sub-title" *ngIf="d.subTitle" [innerHTML]="d.subTitle"></h3>' +
250250
'</div>' +
251-
'<div id="{{msgId}}" class="alert-message" *ngIf="d.message" [innerHTML]="d.message"></div>' +
251+
'<div id="{{msgId}}" class="alert-message" [innerHTML]="d.message"></div>' +
252252
'<div *ngIf="d.inputs.length" [ngSwitch]="inputType">' +
253253

254254
'<template ngSwitchWhen="radio">' +
@@ -335,6 +335,10 @@ class AlertCmp {
335335
} else if (this.d.subTitle) {
336336
this.descId = this.subHdrId;
337337
}
338+
339+
if (!this.d.message) {
340+
this.d.message = '';
341+
}
338342
}
339343

340344
onPageLoaded() {

ionic/components/alert/test/basic/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class E2EPage {
5959
this.nav.present(alert);
6060
}
6161

62-
doAlertNoBody() {
62+
doAlertNoMessage() {
6363
let alert = Alert.create({
6464
title: 'Alert',
6565
buttons: ['OK']

ionic/components/alert/test/basic/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<button block class="e2eOpenAlert" (click)="doAlert()">Alert</button>
88
<button block class="e2eOpenAlertLongMessage" (click)="doAlertLongMessage()">Alert Long Message</button>
99
<button block class="e2eOpenMultipleButtons" (click)="doMultipleButtons()">Multiple Buttons (>2)</button>
10-
<button block class="e2eOpenAlertNoBody" (click)="doAlertNoBody()">Alert No Body</button>
10+
<button block class="e2eOpenAlertNoMessage" (click)="doAlertNoMessage()">Alert No Message</button>
1111
<button block class="e2eOpenConfirm" (click)="doConfirm()">Confirm</button>
1212
<button block class="e2eOpenPrompt" (click)="doPrompt()">Prompt</button>
1313
<button block class="e2eOpenRadio" (click)="doRadio()">Radio</button>

0 commit comments

Comments
 (0)