Skip to content

Commit a92718b

Browse files
committed
feat(modal): ensure header and content background color is inherit from modal
1 parent 911684f commit a92718b

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@import "./content.scss";
2+
3+
// Ionic Content
4+
// --------------------------------------------------
5+
6+
:host(.in-modal) {
7+
--background: var(--ion-bg-surface-default, var(--ion-primitives-base-white));
8+
}

core/src/components/content/content.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ import type { ScrollBaseDetail, ScrollDetail } from './content-interface';
2424
*/
2525
@Component({
2626
tag: 'ion-content',
27-
styleUrl: 'content.scss',
2827
shadow: true,
28+
styleUrls: {
29+
ios: 'content.scss',
30+
md: 'content.scss',
31+
ionic: 'content.ionic.scss',
32+
},
2933
})
3034
export class Content implements ComponentInterface {
3135
private watchDog: ReturnType<typeof setInterval> | null = null;
@@ -458,6 +462,7 @@ export class Content implements ComponentInterface {
458462
'content-sizing': hostContext('ion-popover', this.el),
459463
overscroll: forceOverscroll,
460464
[`content-${rtl}`]: true,
465+
'in-modal': hostContext('ion-modal', this.el),
461466
})}
462467
style={{
463468
'--offset-top': `${this.cTop}px`,

core/src/components/header/header.ionic.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ ion-header {
1111
&.header-divider {
1212
border-bottom: globals.$ion-border-size-025 globals.$ion-border-style-solid globals.$ion-primitives-neutral-300;
1313
}
14+
15+
&.in-modal {
16+
--background: var(--ion-bg-surface-default, var(--ion-primitives-base-white));
17+
}
1418
}
1519

1620
ion-toolbar + ion-toolbar {

core/src/components/header/header.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ export class Header implements ComponentInterface {
236236
[`header-collapse-${collapse}`]: true,
237237
[`header-translucent-${theme}`]: this.translucent,
238238
['header-divider']: divider,
239+
'in-modal': hostContext('ion-modal', this.el),
239240
}}
240241
{...inheritedAttributes}
241242
>

0 commit comments

Comments
 (0)