Skip to content

Commit f4cff58

Browse files
committed
refactor(header): add collapsible role check
1 parent 608ce9a commit f4cff58

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

core/src/components/header/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class Header implements ComponentInterface {
223223
const isCondensed = collapse === 'condense';
224224

225225
// banner role must be at top level, so remove role if inside a menu
226-
const roleType = getRoleType(hostContext('ion-menu', this.el), isCondensed, mode);
226+
const roleType = getRoleType(hostContext('ion-menu', this.el), isCondensed, theme);
227227

228228
return (
229229
<Host

core/src/components/header/header.utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,20 @@ export const handleHeaderFade = (scrollEl: HTMLElement, baseEl: HTMLElement, con
263263
*
264264
* @param isInsideMenu If ion-header is inside ion-menu.
265265
* @param isCondensed If ion-header has collapse="condense".
266-
* @param mode The current mode.
266+
* @param theme The current theme.
267267
* @returns 'none' if inside ion-menu or if condensed in md
268-
* mode, otherwise 'banner'.
268+
* theme, otherwise 'banner'.
269269
*/
270-
export const getRoleType = (isInsideMenu: boolean, isCondensed: boolean, mode: 'ios' | 'md') => {
270+
export const getRoleType = (isInsideMenu: boolean, isCondensed: boolean, theme: 'ios' | 'md' | 'ionic') => {
271271
// If the header is inside a menu, it should not have the banner role.
272272
if (isInsideMenu) {
273273
return ROLE_NONE;
274274
}
275275
/**
276-
* Only apply role="none" to `md` mode condensed headers
276+
* Only apply role="none" to `md` & `ionic` theme condensed headers
277277
* since the large header is never shown.
278278
*/
279-
if (isCondensed && mode === 'md') {
279+
if (isCondensed && theme !== 'ios') {
280280
return ROLE_NONE;
281281
}
282282
// Default to banner role.

0 commit comments

Comments
 (0)