From a40a878a753023234e5dfe0471374c27829da002 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 20 May 2021 10:55:02 +0200 Subject: [PATCH] MOBILE-3751 a11y: Style toolbar headings --- .../features/mainmenu/pages/home/home.html | 5 +- .../features/mainmenu/pages/home/home.scss | 8 +-- src/theme/globals.variables.scss | 2 + src/theme/theme.base.scss | 51 ++++++++++++++++++- 4 files changed, 57 insertions(+), 9 deletions(-) diff --git a/src/core/features/mainmenu/pages/home/home.html b/src/core/features/mainmenu/pages/home/home.html index 310d23b9d..229d684b4 100644 --- a/src/core/features/mainmenu/pages/home/home.html +++ b/src/core/features/mainmenu/pages/home/home.html @@ -3,11 +3,10 @@ - - +

- +

diff --git a/src/core/features/mainmenu/pages/home/home.scss b/src/core/features/mainmenu/pages/home/home.scss index 628c2536f..7c7901130 100644 --- a/src/core/features/mainmenu/pages/home/home.scss +++ b/src/core/features/mainmenu/pages/home/home.scss @@ -1,19 +1,19 @@ @import "~theme/globals"; @if ($core-dashboard-logo) { - .toolbar-title-default.md .title-default .core-header-logo { + .in-toolbar.md h1 .core-header-logo { max-height: $toolbar-md-height - 24; } - .toolbar-title-default.ios .title-default .core-header-logo { + .in-toolbar.ios h1 .core-header-logo { max-height: $toolbar-ios-height - 24; } - .toolbar-title-default .title-default core-format-text { + .in-toolbar h1 core-format-text { display: none; } } @else { - .toolbar-title-default .core-header-logo { + .in-toolbar h1 .core-header-logo { display: none; } } diff --git a/src/theme/globals.variables.scss b/src/theme/globals.variables.scss index ead1d7b21..f21119486 100644 --- a/src/theme/globals.variables.scss +++ b/src/theme/globals.variables.scss @@ -269,6 +269,8 @@ $z-index-overlay-wrapper: 10; $toolbar-background: $brand-color !default; $toolbar-color: get_contrast_color($toolbar-background) !default; $toolbar-button-image-size: 44px !default; +$toolbar-height-md: 56px !default; +$toolbar-height-ios: 54px !default; // Bottom tab bar. $bottom-tabs-background: $white !default; diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index 9a6c0b429..7356aa589 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -49,11 +49,50 @@ .font-lg { font-size: 1.7rem; } .font-sm { font-size: 1.2rem; } +// Headings. .item-heading { font-size: 16px !important; color: initial !important; } +ion-header h1, +ion-header h2 { + display: block; + transform: translateZ(0); + color: initial; + margin: 0; + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + pointer-events: auto; +} + +ion-app.md ion-header h1, +ion-app.md ion-header h2 { + padding-inline: 20px; + font-size: 20px; + font-weight: 500; + letter-spacing: .0125em; +} + +ion-app.ios ion-header h1, +ion-app.ios ion-header h2 { + top: 0; + left: 0; + padding-inline: 90px; + position: absolute; + display: block; + text-align: center; + width: 100%; + transform: translateZ(0); + font-size: 17px; + font-weight: 600; + line-height: #{$toolbar-height-ios}; + box-sizing: border-box; + pointer-events: none; +} + // Correctly inherit ion-text-wrap onto labels. ion-item.ion-text-wrap ion-label { white-space: normal !important; @@ -80,6 +119,14 @@ ion-item.ion-text-wrap ion-label { } // Ionic toolbar. +ion-app.md ion-toolbar { + --min-height: #{$toolbar-height-md}; +} + +ion-app.ios ion-toolbar { + --min-height: #{$toolbar-height-ios}; +} + ion-toolbar ion-back-button, ion-toolbar .in-toolbar.button-clear { --color: var(--core-header-toolbar-color); @@ -387,8 +434,8 @@ ion-item img.core-module-icon[slot="start"] { margin-left: 32px; } -ion-toolbar ion-title img.core-bar-button-image, -ion-toolbar ion-title .core-bar-button-image img { +ion-toolbar h1 img.core-bar-button-image, +ion-toolbar h1 .core-bar-button-image img { padding: 0; width: var(--core-header-toolbar-button-image-size); height: var(--core-header-toolbar-button-image-size);