Skip to content

Commit ee059a1

Browse files
fix(accordion): refactor nested accordion styles and remove additional class
1 parent 48e6c69 commit ee059a1

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

core/src/components/accordion/accordion.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ export class Accordion implements ComponentInterface {
200200
if (ionItem.lines === undefined) {
201201
ionItem.lines = 'full';
202202
}
203-
204-
/**
205-
* Add a class to identify this item as an accordion header
206-
* for specific styling purposes
207-
*/
208-
ionItem.classList.add('accordion-header-item');
209203
};
210204

211205
private getSlottedHeaderIonItem = () => {

core/src/components/accordion/test/states/accordion.e2e.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
6262
config
6363
);
6464

65-
const firstHeaderItem = page.locator('ion-accordion').first().locator('ion-item[slot="header"]');
66-
await expect(firstHeaderItem).toHaveClass(/accordion-header-item/);
67-
6865
const accordionGroup = page.locator('ion-accordion-group');
6966

7067
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-activated'));
@@ -161,9 +158,6 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
161158
config
162159
);
163160

164-
const firstHeaderItem = page.locator('ion-accordion').first().locator('ion-item[slot="header"]');
165-
await expect(firstHeaderItem).toHaveClass(/accordion-header-item/);
166-
167161
const accordionGroup = page.locator('ion-accordion-group');
168162

169163
await expect(accordionGroup).toHaveScreenshot(screenshot('accordion-states-inset-activated'));

core/src/components/item/item.ionic.scss

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,4 @@ slot[name="end"]::slotted(*) {
121121

122122
:host(.in-select-modal.ion-focused) .item-native {
123123
--border-radius: #{globals.$ion-border-radius-400};
124-
}
125-
126-
// Item in Accordion
127-
// --------------------------------------------------
128-
// Ensure button element in accordion header has proper horizontal padding specifically for nested accordions
129-
:host(.accordion-header-item) .item-native {
130-
@include globals.padding-horizontal(globals.$ion-space-400);
131-
}
124+
}

core/src/css/ionic/core.ionic.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,16 @@ ion-accordion > [slot="content"] ion-item {
332332

333333
color: globals.$ion-primitives-neutral-1000;
334334

335-
--padding-start: 0;
336335
--padding-top: #{globals.$ion-space-300};
337336
--padding-bottom: #{globals.$ion-space-300};
338-
--padding-end: 0;
339337
--min-height: #{globals.$ion-scale-700};
340338
}
341339

340+
ion-accordion > [slot="content"] ion-item:not([slot="header"]) {
341+
--padding-start: 0;
342+
--padding-end: 0;
343+
}
344+
342345
// Datetime Styles
343346
// --------------------------------------------------
344347

0 commit comments

Comments
 (0)