Skip to content

Commit 56a03e6

Browse files
author
Hector Arce De Las Heras
committed
Implement Dynamic Text Resizing for iOS Accessibility
This commit introduces the use of -apple-system-body font, allowing text size to dynamically adjust based on the user's accessibility settings in iOS. This change enhances the application's accessibility by respecting the text size preferences set by the user in their device settings.
1 parent 454badb commit 56a03e6

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

src/provider/global.style.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
1-
import { CSSProp, createGlobalStyle } from 'styled-components';
1+
import { CSSProp, createGlobalStyle, css } from 'styled-components';
22

33
type GlobalStyle = {
44
custom: CSSProp;
55
customFonts?: CSSProp;
66
};
77

8+
export const commonElementStyles = css`
9+
margin: 0;
10+
padding: 0;
11+
vertical-align: baseline;
12+
margin-block-start: 0;
13+
margin-block-end: 0;
14+
margin-inline-start: 0;
15+
margin-inline-end: 0;
16+
box-sizing: border-box;
17+
background-color: transparent;
18+
border: 0;
19+
`;
20+
821
export const GlobalStyle = createGlobalStyle<GlobalStyle>`
922
${props => props.custom}
1023
${props => props.customFonts}
1124
12-
html, body, div, span, applet, object, iframe,
25+
@supports (font: -apple-system-body) {
26+
html {
27+
font: -apple-system-body;
28+
}
29+
}
30+
31+
html {
32+
${commonElementStyles}
33+
}
34+
35+
body, div, span, applet, object, iframe,
1336
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
1437
a, abbr, acronym, address, big, cite, code,
1538
del, dfn, em, img, ins, kbd, q, s, samp,
@@ -22,17 +45,8 @@ export const GlobalStyle = createGlobalStyle<GlobalStyle>`
2245
figure, figcaption, footer, header, hgroup,
2346
menu, nav, output, ruby, section, summary,
2447
time, mark, audio, video, dialog, input, button {
25-
margin: 0;
26-
padding: 0;
2748
font-size: 100%;
28-
vertical-align: baseline;
29-
margin-block-start: 0;
30-
margin-block-end: 0;
31-
margin-inline-start: 0;
32-
margin-inline-end: 0;
33-
box-sizing: border-box;
34-
background-color: transparent;
35-
border: 0;
49+
${commonElementStyles}
3650
}
3751
dialog {
3852
border: 0;

0 commit comments

Comments
 (0)