Skip to content

Commit cac12b3

Browse files
authored
feat(select-modal): add select default modal styling for ionic theme (#30771)
Issue number: resolves # --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? Once IonSelect was using a modal-default (with no breakpoints) the styling of the modal do not fit with the expected ones for ionic theme. <img width="433" height="933" alt="Screenshot 2025-11-06 at 11 01 00" src="https://github.com/user-attachments/assets/c9e23203-0f42-4ee3-af23-9d8f43936fd3" /> ## What is the new behavior? Under the same context new styling has been added. <img width="429" height="930" alt="Screenshot 2025-11-06 at 11 01 22" src="https://github.com/user-attachments/assets/e6fdfea0-2b09-424e-bb83-4af3c66d67a4" /> ## Does this introduce a breaking change? - [ ] Yes - [X] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. -->
1 parent 7828a7a commit cac12b3

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

core/src/components/modal/modal.ionic.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
--border-radius: #{globals.$ion-border-radius-0};
2828
}
2929

30+
// Default Modal
31+
// --------------------------------------------------
32+
33+
// Modal when inside a select default-modal
34+
:host(.select-modal.modal-default) {
35+
--max-height: 45%;
36+
--max-width: calc(100% - (#{globals.$ion-space-400} * 2));
37+
--min-height: 340px;
38+
}
39+
3040
// Sheet Modal
3141
// --------------------------------------------------
3242

core/src/components/select-modal/select-modal.ionic.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
// Ionic Select Modal
55
// --------------------------------------------------
66

7+
:host(.in-modal-default) ion-content::part(scroll) {
8+
--padding-bottom: #{globals.$ion-space-400};
9+
}
10+
711
// Item
812
// ----------------------------------------------------------------
913

core/src/components/select-modal/select-modal.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getIonMode } from '@global/ionic-global';
22
import type { ComponentInterface } from '@stencil/core';
33
import { Component, Element, Host, Prop, forceUpdate, h } from '@stencil/core';
44
import { safeCall } from '@utils/overlays';
5-
import { getClassMap } from '@utils/theme';
5+
import { getClassMap, hostContext } from '@utils/theme';
66

77
import type { CheckboxCustomEvent } from '../checkbox/checkbox-interface';
88
import type { RadioGroupCustomEvent } from '../radio-group/radio-group-interface';
@@ -74,6 +74,14 @@ export class SelectModal implements ComponentInterface {
7474
}
7575
}
7676

77+
private getModalContextClasses() {
78+
const el = this.el;
79+
return {
80+
'in-modal-default': hostContext('ion-modal.modal-default', el),
81+
'in-modal-sheet': hostContext('ion-modal.modal-sheet', el),
82+
};
83+
}
84+
7785
private renderRadioOptions() {
7886
const checked = this.options.filter((o) => o.checked).map((o) => o.value)[0];
7987

@@ -143,7 +151,12 @@ export class SelectModal implements ComponentInterface {
143151

144152
render() {
145153
return (
146-
<Host class={getIonMode(this)}>
154+
<Host
155+
class={{
156+
[getIonMode(this)]: true,
157+
...this.getModalContextClasses(),
158+
}}
159+
>
147160
<ion-header>
148161
<ion-toolbar>
149162
{this.header !== undefined && <ion-title>{this.header}</ion-title>}

0 commit comments

Comments
 (0)