@classic-homes/theme-styles 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,6 +34,18 @@ The main entry defines the cascade layers, brand fonts, tokens, base, accessibil
34
34
  | `@classic-homes/theme-styles/accessibility` | Accessibility styles |
35
35
  | `@classic-homes/theme-styles/utilities` | Utility classes |
36
36
 
37
+ ### Touch field size
38
+
39
+ On touch devices (and any iOS/iPadOS WebKit, including an iPad with a trackpad), text inputs, textareas, selects and contenteditable regions get `font-size: 16px !important`, so iOS doesn't zoom the page when a field is focused. Desktop keeps the compact sizes. Don't add `maximum-scale` to the viewport tag for this — that also blocks pinch-zoom on Android.
40
+
41
+ Opt out with `data-keep-field-size` on a field or any ancestor, for example a canvas whose text boxes are always rendered at a designed size:
42
+
43
+ ```html
44
+ <div class="board-canvas" data-keep-field-size>…</div>
45
+ ```
46
+
47
+ Opted-out fields can still zoom on iOS; stop that another way where needed (for example `maximum-scale=1` on the viewport tag while the canvas is shown).
48
+
37
49
  Use `/core` when the app already loads brand fonts:
38
50
 
39
51
  ```css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-styles",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Base styles and utilities for the Classic Theme design system",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -68,6 +68,65 @@
68
68
  }
69
69
  }
70
70
 
71
+ /* ===== Touch Field Size (no iOS zoom-on-focus) ===== */
72
+
73
+ /* iOS (Safari and home-screen web apps) zooms the page to a focused field
74
+ whose font is under 16px, and compact fields (text-sm/text-xs) are. Touch
75
+ devices get 16px text fields; desktop keeps the compact sizes. Unlayered
76
+ and !important so it beats per-field utilities and inline sizes. Use this
77
+ rather than viewport maximum-scale, which also blocks pinch-zoom on
78
+ Android. The media query covers phones and tablets; the @supports block
79
+ (iOS/iPadOS WebKit only) covers an iPad with a trackpad, which reports
80
+ pointer: fine but still zooms.
81
+
82
+ Opt out with data-keep-field-size on a field or container, e.g. a canvas
83
+ whose text boxes are always rendered at a designed size (stop the zoom
84
+ there another way, such as maximum-scale while the canvas is shown). */
85
+
86
+ @media (hover: none) and (pointer: coarse) {
87
+ :is(
88
+ input:not(
89
+ [type='checkbox'],
90
+ [type='radio'],
91
+ [type='range'],
92
+ [type='color'],
93
+ [type='file'],
94
+ [type='button'],
95
+ [type='submit'],
96
+ [type='reset'],
97
+ [type='image'],
98
+ [type='hidden']
99
+ ),
100
+ textarea,
101
+ select,
102
+ [contenteditable]:not([contenteditable='false'])
103
+ ):not([data-keep-field-size], [data-keep-field-size] *) {
104
+ font-size: 16px !important;
105
+ }
106
+ }
107
+
108
+ @supports (-webkit-touch-callout: none) {
109
+ :is(
110
+ input:not(
111
+ [type='checkbox'],
112
+ [type='radio'],
113
+ [type='range'],
114
+ [type='color'],
115
+ [type='file'],
116
+ [type='button'],
117
+ [type='submit'],
118
+ [type='reset'],
119
+ [type='image'],
120
+ [type='hidden']
121
+ ),
122
+ textarea,
123
+ select,
124
+ [contenteditable]:not([contenteditable='false'])
125
+ ):not([data-keep-field-size], [data-keep-field-size] *) {
126
+ font-size: 16px !important;
127
+ }
128
+ }
129
+
71
130
  @layer classic-theme.utilities {
72
131
  /* ===== Skip Link (WCAG 2.4.1) ===== */
73
132