You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(item): remove deprecated highlight variables used with legacy form controls (#29055)
Issue number: internal
---------
## What is the current behavior?
In Ionic Framework v7, we [simplified the form control
syntax](https://ionic.io/blog/ionic-7-is-here#simplified-form-control-syntax),
eliminating the requirement to place form controls inside of an
`ion-item`. We ensured backwards compatibility by introducing a `legacy`
property for the form controls and keeping, but deprecating, the
following CSS variables on item:
```css
--highlight-color-focused
--highlight-color-invalid
--highlight-color-valid
--highlight-height
```
While this was supported in v7, console warnings were logged to notify
developers that they needed to update to the modern syntax if they were
using form controls in an item for the best accessibility experience.
## What is the new behavior?
Removes the `--highlight-color-focused`, `--highlight-color-invalid`,
`--highlight-color-valid`, and `--highlight-height` variables from item.
## Does this introduce a breaking change?
- [x] Yes
- [ ] No
Steps taken to mitigate this breaking change:
1. Developers have had console warnings when using the legacy syntax
since the v7 release and the variables were marked as `deprecated`.
2. The removal of these CSS variables has been documented in the
Breaking Changes document with a link to the migration guides for the
affected form controls.
BREAKING CHANGE:
The following CSS variables have been removed from item:
`--highlight-height`, `--highlight-color-focused`,
`--highlight-color-valid`, and `--highlight-color-invalid`. These
variables were used on the bottom border highlight of an item when the
form control inside of that item was focused. The form control syntax
was [simplified in
v7](https://ionic.io/blog/ionic-7-is-here#simplified-form-control-syntax)
so that inputs, selects, and textareas would no longer be required to be
used inside of an item.
If you have not yet migrated to the modern form control syntax,
migration guides for each of the form controls that added a highlight to
item can be found below:
- [Input migration
documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax)
- [Select migration
documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax)
- [Textarea migration
documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax)
The highlight variables should then be moved from the item to the form
control:
```diff
- ion-item {
+ ion-input,
+ ion-textarea,
+ ion-select {
--highlight-color-focused: purple;
--highlight-color-valid: blue;
--highlight-color-invalid: orange;
--highlight-height: 6px;
}
```
> [!NOTE]
> The input and textarea components are scoped, which means they will
automatically scope their CSS by appending each of the styles with an
additional class at runtime. Overriding scoped selectors in CSS requires
a [higher
specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)
selector. Targeting the `ion-input` or `ion-textarea` for customization
will not work; therefore we recommend adding a class and customizing it
that way.
---------
Co-authored-by: Sean Perkins <[email protected]>
Copy file name to clipboardExpand all lines: BREAKING.md
+50-7Lines changed: 50 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,6 @@ This is a comprehensive list of the breaking changes introduced in the major ver
21
21
-[Checkbox](#version-8x-checkbox)
22
22
-[Content](#version-8x-content)
23
23
-[Datetime](#version-8x-datetime)
24
-
-[Item](#version-8x-item)
25
24
-[Input](#version-8x-input)
26
25
-[Item](#version-8x-item)
27
26
-[Modal](#version-8x-modal)
@@ -138,6 +137,7 @@ Developers who had previously chosen dynamic font scaling by activating it in th
138
137
Developers who want to disable dynamic font scaling can set `--ion-dynamic-font: initial;` in their global stylesheets. However, this is not recommended because it may introduce accessibility challenges for users who depend on enlarged font sizes.
139
138
140
139
For more information on the dynamic font, refer to the [Dynamic Font Scaling documentation](https://ionicframework.com/docs/layout/dynamic-font-scaling).
140
+
141
141
<h2id="version-8x-components">Components</h2>
142
142
143
143
<h4id="version-8x-button">Button</h4>
@@ -163,23 +163,66 @@ For more information on the dynamic font, refer to the [Dynamic Font Scaling doc
163
163
+ background: red;
164
164
}
165
165
```
166
+
167
+
<h4 id="version-8x-input">Input</h4>
168
+
169
+
- `size` has been removed from the `ion-input` component. Developers should use CSS to specify the visible width of the input.
170
+
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
171
+
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
172
+
166
173
<h4 id="version-8x-item">Item</h4>
167
174
168
175
- The `helper` slot has been removed. Developers should use the `helperText` property on `ion-input` and `ion-textarea`.
169
176
- The `error` slot has been removed. Developers should use the `errorText` property on `ion-input` and `ion-textarea`.
170
177
- Counter functionality has been removed including the `counter` and `counterFormatter` properties. Developers should use the properties of the same name on `ion-input` and `ion-textarea`.
171
178
- The `fill` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
172
179
- The `shape` property has been removed. Developers should use the property of the same name on `ion-input`, `ion-select`, and `ion-textarea`.
180
+
- Item no longer automatically delegates focus to the first focusable element. While most developers should not need to make any changes to account for this update, usages of `ion-item` with interactive elements such as form controls (inputs, textareas, etc) should be evaluated to verify that interactions still work as expected.
173
181
174
-
<h4 id="version-8x-input">Input</h4>
182
+
<h5>CSS variables</h4>
175
183
176
-
- `size` has been removed from the `ion-input` component. Developers should use CSS to specify the visible width of the input.
177
-
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
178
-
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
184
+
The following deprecated CSS variables have been removed: `--highlight-height`, `--highlight-color-focused`, `--highlight-color-valid`, and `--highlight-color-invalid`. These variables were used on the bottom border highlight of an item when the form control inside of that item was focused. The form control syntax was [simplified in v7](https://ionic.io/blog/ionic-7-is-here#simplified-form-control-syntax) so that inputs, selects, and textareas would no longer be required to be used inside of an item.
179
185
180
-
<h4 id="version-8x-item">Item</h4>
186
+
If you have not yet migrated to the modern form control syntax, migration guides for each of the form controls that added a highlight to item can be found below:
- Item no longer automatically delegates focus to the first focusable element. While most developers should not need to make any changes to account for this update, usages of `ion-item` with interactive elements such as form controls (inputs, textareas, etc) should be evaluated to verify that interactions still work as expected.
191
+
Once all form controls are using the modern syntax, the same variables can be used to customize them from the form control itself:
| `--highlight-color-focused` | The color of the highlight when focused |
196
+
| `--highlight-color-invalid` | The color of the highlight when invalid |
197
+
| `--highlight-color-valid` | The color of the highlight when valid |
198
+
| `--highlight-height` | The height of the highlight indicator |
199
+
200
+
The following styles for item:
201
+
202
+
```css
203
+
ion-item {
204
+
--highlight-color-focused: purple;
205
+
--highlight-color-valid: blue;
206
+
--highlight-color-invalid: orange;
207
+
--highlight-height: 6px;
208
+
}
209
+
```
210
+
211
+
will instead be applied on the form controls:
212
+
213
+
```css
214
+
ion-input,
215
+
ion-textarea,
216
+
ion-select {
217
+
--highlight-color-focused: purple;
218
+
--highlight-color-valid: blue;
219
+
--highlight-color-invalid: orange;
220
+
--highlight-height: 6px;
221
+
}
222
+
```
223
+
224
+
> [!NOTE]
225
+
> The input and textarea components are scoped, which means they will automatically scope their CSS by appending each of the styles with an additional class at runtime. Overriding scoped selectors in CSS requires a [higher specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) selector. Targeting the `ion-input` or `ion-textarea` for customization will not work; therefore we recommend adding a class and customizing it that way.
0 commit comments