Skip to content

Commit b297529

Browse files
fix(core): allow fullscreen scroll content to flow outside container for translucent tab bar (#28246)
Issue number: resolves #17676 --------- <!-- 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? <!-- Please describe the current behavior that you are modifying. --> The IonNav, IonRouterOutlet, and .ion-page elements have `overflow: hidden` which prevent content from spilling out of it. This was likely done to prevent these elements from having overflow scroll (since the inner IonContent should be scrollable). However, this breaks the translucency effect on IonTabBar because the content in IonContent can not scroll under the IonTabBar. ```html <ion-tabs> <ion-router-outlet> <!-- this has overflow: hidden --> ... <ion-content fullscreen="true">...</ion-content> </ion-router-outlet> <ion-tab-bar translucent="true">...</ion-tab-bar> </ion-tabs> ``` In Ionic v3 components such as IonTabs and IonNav did have `overflow: hidden`: https://github.com/ionic-team/ionic-v3/blob/cf35d5eb7f38d088e7c2588e42738228c39e9964/src/components/app/app.scss#L241-L246 However, components like IonNav were not used inside of tabs at the time, so the reported bug was not a problem then. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Removed `overflow: hidden` from IonNav, IonRouterOutlet, and .ion-page. This change seems safe to make because the `position: absolute` and top/right/bottom/left values should ensure that these elements take up the available screen space and avoid having overflow scrolling. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.4.2-dev.11695832397.13fa6703` Note: Fixing this reveals #21130 which is why this fix is dependent on the linked issue getting fixed first. --------- Co-authored-by: ionitron <[email protected]>
1 parent 7375dd6 commit b297529

File tree

6 files changed

+35
-3
lines changed

6 files changed

+35
-3
lines changed

core/src/components/nav/nav.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
position: absolute;
77

88
contain: layout size style;
9-
overflow: hidden;
109
z-index: $z-index-page-container;
1110
}

core/src/components/router-outlet/router-outlet.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
position: absolute;
77

88
contain: layout size style;
9-
overflow: hidden;
109
z-index: $z-index-page-container;
1110
}

core/src/components/tab-bar/test/translucent/tab-bar.e2e.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,40 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c
3939

4040
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-translucent`));
4141
});
42+
test('should render translucent tab bar even when wrapped in a page container', async ({ page }) => {
43+
await page.setContent(
44+
`
45+
<style>
46+
ion-content {
47+
--background: linear-gradient(to right, orange, yellow, green, cyan, blue, violet);
48+
}
49+
</style>
50+
<ion-tabs>
51+
<div class="ion-page">
52+
<ion-content fullscreen="true">My Content</ion-content>
53+
</div>
54+
<ion-tab-bar slot="bottom" translucent="true" selected-tab="1">
55+
<ion-tab-button tab="1">
56+
<ion-label>Recents</ion-label>
57+
</ion-tab-button>
58+
59+
<ion-tab-button tab="2">
60+
<ion-label>Favorites</ion-label>
61+
<ion-badge>23</ion-badge>
62+
</ion-tab-button>
63+
64+
<ion-tab-button tab="3">
65+
<ion-label>Settings</ion-label>
66+
</ion-tab-button>
67+
</ion-tab-bar>
68+
</ion-tabs>
69+
`,
70+
config
71+
);
72+
73+
const tabBar = page.locator('ion-tab-bar');
74+
75+
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-translucent-container`));
76+
});
4277
});
4378
});
Loading
Loading

core/src/css/core.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ html.ios ion-modal.modal-card .ion-page {
156156
justify-content: space-between;
157157

158158
contain: layout size style;
159-
overflow: hidden;
160159
z-index: $z-index-page-container;
161160
}
162161

0 commit comments

Comments
 (0)