Files
ionic-framework/core/src/components/alert/alert.md.scss
Liam DeBeasi f8067819ee feat(a11y): add dynamic font scaling (#28314)
Issue number: resolves #24638, resolves #18592

---------

<!-- 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. -->

Developers have requested that Ionic Framework support the dynamic type
feature on iOS for accessibility purposes. Ionic applications do not
respond to font scaling on iOS which can create inaccessible
applications particularly for users with low vision. Ionic apps on
Android devices currently support the Android equivalent due to
functionality in the Chromium webview.

Developers have also requested a way of adjusting the fonts in their
Ionic UI components consistently.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Ionic components now use `rem` instead of `px` where appropriate. This
means devs can change the font size on `html` and the text in supported
Ionic components will scale up/down appropriately
- Add support for Dynamic Type on iOS (the iOS version of Dynamic Font
Scaling)

## 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. -->

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: Shawn Taylor <shawn@ionic.io>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Sean Perkins <sean@ionic.io>
Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
2023-10-10 17:38:09 -04:00

285 lines
7.4 KiB
SCSS

@import "./alert";
@import "./alert.md.vars";
// Material Design Alert
// --------------------------------------------------
:host {
--background: #{$alert-md-background-color};
--max-width: #{$alert-md-max-width};
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);
font-size: $alert-md-font-size;
}
.alert-wrapper {
@include border-radius($alert-md-border-radius);
box-shadow: $alert-md-box-shadow;
}
// Material Design Alert Header
// --------------------------------------------------
.alert-head {
@include padding($alert-md-head-padding-top, $alert-md-head-padding-end, $alert-md-head-padding-bottom, $alert-md-head-padding-start);
text-align: $alert-md-head-text-align;
}
.alert-title {
color: $alert-md-title-color;
font-size: $alert-md-title-font-size;
font-weight: $alert-md-title-font-weight;
}
.alert-sub-title {
color: $alert-md-sub-title-text-color;
font-size: $alert-md-sub-title-font-size;
}
// Material Design Alert Message
// --------------------------------------------------
.alert-message,
.alert-input-group {
@include padding($alert-md-message-padding-top, $alert-md-message-padding-end, $alert-md-message-padding-bottom, $alert-md-message-padding-start);
color: $alert-md-message-text-color;
}
.alert-message {
max-height: $alert-md-content-max-height;
font-size: $alert-md-message-font-size;
}
.alert-message:empty {
@include padding($alert-md-message-empty-padding-top, $alert-md-message-empty-padding-end, $alert-md-message-empty-padding-bottom, $alert-md-message-empty-padding-start);
}
.alert-head + .alert-message {
padding-top: 0;
}
// Material Design Alert Input
// --------------------------------------------------
.alert-input {
@include margin($alert-md-input-margin-top, $alert-md-input-margin-end, $alert-md-input-margin-bottom, $alert-md-input-margin-start);
border-bottom: $alert-md-input-border-width $alert-md-input-border-style $alert-md-input-border-color;
color: $alert-md-input-text-color;
&::placeholder {
color: $alert-md-input-placeholder-color;
font-family: inherit;
font-weight: inherit;
}
&::-ms-clear {
display: none;
}
}
.alert-input:focus {
@include margin(null, null, $alert-md-input-margin-bottom - 1, null);
border-bottom: $alert-md-input-border-width-focused $alert-md-input-border-style-focused $alert-md-input-border-color-focused;
}
// Material Design Alert Radio/Checkbox Group
// --------------------------------------------------
.alert-radio-group,
.alert-checkbox-group {
position: relative;
max-height: $alert-md-content-max-height;
border-top: $alert-md-list-border-top;
border-bottom: $alert-md-list-border-bottom;
overflow: auto;
}
.alert-tappable {
position: relative;
min-height: $alert-md-tappable-height;
}
// Material Design Alert Radio
// --------------------------------------------------
.alert-radio-label {
@include padding($alert-md-radio-label-padding-top, $alert-md-radio-label-padding-end, $alert-md-radio-label-padding-bottom, $alert-md-radio-label-padding-start);
flex: 1;
color: $alert-md-radio-label-text-color;
font-size: $alert-md-radio-label-font-size;
}
// Material Design Alert Radio Unchecked Circle
// ---------------------------------------------------
.alert-radio-icon {
@include position($alert-md-radio-top, null, null, $alert-md-radio-left);
@include border-radius($alert-md-radio-border-radius);
display: block;
position: relative;
width: $alert-md-radio-width;
height: $alert-md-radio-height;
border-width: $alert-md-radio-border-width;
border-style: $alert-md-radio-border-style;
border-color: $alert-md-radio-border-color-off;
}
// Material Design Alert Radio Checked Dot
// ---------------------------------------------------
.alert-radio-inner {
@include position($alert-md-radio-icon-top, null, null, $alert-md-radio-icon-start);
@include border-radius($alert-md-radio-icon-border-radius);
position: absolute;
width: $alert-md-radio-icon-width;
height: $alert-md-radio-icon-height;
transform: $alert-md-radio-icon-transform-off;
transition: $alert-md-radio-icon-transition;
background-color: $alert-md-radio-border-color-on;
}
// Material Design Alert Radio Checked
// ---------------------------------------------------
[aria-checked=true] .alert-radio-label {
color: $alert-md-radio-label-text-color-checked;
}
[aria-checked=true] .alert-radio-icon {
border-color: $alert-md-radio-border-color-on;
}
[aria-checked=true] .alert-radio-inner {
transform: $alert-md-radio-icon-transform-on;
}
// Material Design Alert Checkbox Label
// --------------------------------------------------
.alert-checkbox-label {
@include padding($alert-md-checkbox-label-padding-top, $alert-md-checkbox-label-padding-end, $alert-md-checkbox-label-padding-bottom, $alert-md-checkbox-label-padding-start);
flex: 1;
// Required for the checkbox icon to stay on the screen without
// being squished when the font size scales up.
width: calc(100% - $alert-md-checkbox-label-padding-start);
color: $alert-md-checkbox-label-text-color;
font-size: $alert-md-checkbox-label-font-size;
}
// Material Design Alert Checkbox Outline: Unchecked
// --------------------------------------------------
.alert-checkbox-icon {
@include position($alert-md-checkbox-top, null, null, $alert-md-checkbox-left);
@include border-radius($alert-md-checkbox-border-radius);
position: relative;
width: $alert-md-checkbox-width;
height: $alert-md-checkbox-height;
border-width: $alert-md-checkbox-border-width;
border-style: $alert-md-checkbox-border-style;
border-color: $alert-md-checkbox-border-color-off;
contain: strict;
}
// Material Design Alert Checkbox Checkmark: Checked
// --------------------------------------------------
[aria-checked=true] .alert-checkbox-icon {
border-color: $alert-md-checkbox-border-color-on;
background-color: $alert-md-checkbox-border-color-on;
}
[aria-checked=true] .alert-checkbox-inner {
@include position($alert-md-checkbox-icon-top, null, null, $alert-md-checkbox-icon-start);
position: absolute;
width: $alert-md-checkbox-icon-width;
height: $alert-md-checkbox-icon-height;
transform: $alert-md-checkbox-icon-transform;
border-width: $alert-md-checkbox-icon-border-width;
border-top-width: 0;
border-left-width: 0;
border-style: $alert-md-checkbox-icon-border-style;
border-color: $alert-md-checkbox-icon-border-color;
}
// Material Design Alert Button
// --------------------------------------------------
.alert-button-group {
@include padding(8px);
box-sizing: border-box;
flex-wrap: $alert-md-button-group-flex-wrap;
justify-content: $alert-md-button-group-justify-content;
}
.alert-button {
@include border-radius($alert-md-button-border-radius);
@include margin($alert-md-button-margin-top, $alert-md-button-margin-end, $alert-md-button-margin-bottom, $alert-md-button-margin-start);
@include padding($alert-md-button-padding-top, $alert-md-button-padding-end, $alert-md-button-padding-bottom, $alert-md-button-padding-start);
// necessary for ripple to work properly
position: relative;
background-color: $alert-md-button-background-color;
color: $alert-md-button-text-color;
font-weight: $alert-md-button-font-weight;
text-align: $alert-md-button-text-align;
text-transform: $alert-md-button-text-transform;
overflow: hidden;
}
.alert-button-inner {
justify-content: $alert-md-button-group-justify-content;
}