Skip to content

Commit cc3e51f

Browse files
chore(textfield,textarea): add migration guide to changelog (#3329)
1 parent 25228c2 commit cc3e51f

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

components/textfield/CHANGELOG.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
518518

519519
🗓 2023-05-18 • 📝 [Commits](https://github.com/adobe/spectrum-css/compare/@spectrum-css/[email protected]...@spectrum-css/[email protected])
520520

521+
### Features
522+
523+
#### Icons
524+
525+
Icons are now added as SVGs, with `svg.spectrum-Textfield-validationIcon` used for the UI icons that can indicate valid or invalid input.
526+
521527
### 🐛 Bug fixes
522528

523529
- **textfield, stepper:** button padding and focus indicator ([#1863](https://github.com/adobe/spectrum-css/issues/1863)) ([7963b85](https://github.com/adobe/spectrum-css/commit/7963b85))
@@ -850,6 +856,69 @@ there, but it was missing a control for testing.
850856
- **textfield:** WHCM setup WIP ([feb62af](https://github.com/adobe/spectrum-css/commit/feb62af))
851857
- **textfield:** windows high contrast mode ([e30149c](https://github.com/adobe/spectrum-css/commit/e30149c))
852858

859+
### Migration guide
860+
861+
#### T-shirt sizes
862+
863+
As of token migration, textfield now has t-shirt sizes. Medium is the default size if no size variant is applied. Icon sizes must match each t-shirt size.
864+
865+
#### Label
866+
867+
As of token migration, textfield must always have a label. Label placement is top or on the side (start).
868+
869+
#### Character Count
870+
871+
As of token migration, textfield now has an optional character count. The character count moves to the side (end) when the label position is on the side (start). This count needs to be read by a screen reader but we cannot just use a live region as that will result in an overly verbose experience Adjust the markup of the character count for optimal accessibility for each API.
872+
873+
#### Help Text
874+
875+
As of token migration, Help text is optional and has only one position below the textfield input. Help text aligns with the input in both standard and side label layouts.
876+
877+
#### Composition
878+
879+
As of spectrum tokens migration, Textfield uses grid to align the label, character count, helptext, and focus indicator in both the default and side label layouts.
880+
881+
Any application using Textarea Grows (Textarea input which automatically resizes vertically to accommodate content that is entered) will need to place the sizer element within the same grid area as the input and focus indicator.
882+
883+
#### Indicating validity and focus
884+
885+
##### Valid Icon
886+
887+
Validation icons are as follows.
888+
Small
889+
`spectrum-Icon spectrum-UIIcon-Checkmark75 spectrum-Textfield-validationIcon`
890+
891+
Medium
892+
`spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Textfield-validationIcon`
893+
894+
Large
895+
`spectrum-Icon spectrum-UIIcon-Checkmark200 spectrum-Textfield-validationIcon`
896+
897+
Extra Large
898+
`spectrum-Icon spectrum-UIIcon-Checkmark7300 spectrum-Textfield-validationIcon`
899+
900+
##### Invalid Icon
901+
902+
Uses #spectrum-icon-18-Alert
903+
904+
Small
905+
`spectrum-Icon spectrum-Icon--sizeS spectrum-Textfield-validationIcon`
906+
907+
Medium
908+
`spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon`
909+
910+
Large
911+
`spectrum-Icon spectrum-Icon--sizeL spectrum-Textfield-validationIcon`
912+
913+
Extra Large
914+
`spectrum-Icon spectrum-Icon--sizeXL spectrum-Textfield-validationIcon`
915+
916+
##### Removal of `:valid`, `:invalid`, and `::placeholder`
917+
918+
Textfield no longer supports the CSS pseudo selectors [`:invalid`](https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid) and [`:value`](https://developer.mozilla.org/en-US/docs/Web/CSS/:valid).
919+
920+
The CSS pseudo-element [`::placeholder`](https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder) has been deprecated due to accessibility. The styling remains for backwards compatibility but it is advised to stop utilizing placeholders moving forward.
921+
853922
### 🐛 Bug fixes
854923

855924
- **stepper, textfield:** revert use of has ([c26c64f](https://github.com/adobe/spectrum-css/commit/c26c64f))
@@ -1334,6 +1403,39 @@ there, but it was missing a control for testing.
13341403

13351404
- refactor Textfield to be decorated, closes [#142](https://github.com/adobe/spectrum-css/issues/142) ([d34be59](https://github.com/adobe/spectrum-css/commit/d34be59))
13361405

1406+
### Migration guide
1407+
1408+
Notes below apply to both text field and text area.
1409+
1410+
#### Composition
1411+
1412+
As of 3.0.0, Textfield is now composed the same way a DecoratedTextfield was previously. That is, the outer element `div.spectrum-Textfield` contains a `input.spectrum-Textfield-input`.
1413+
1414+
#### Icons
1415+
1416+
The `<svg>` element should appear before the `<input>` element.
1417+
1418+
#### Indicating validity and focus
1419+
1420+
Validity and focus must be bubbled up to the parent so adjacent siblings can be styled.
1421+
1422+
Thus, implementations must add the following classes in the following situations:
1423+
1424+
- `.spectrum-Textfield.is-focused` - when the input is focused with the mouse
1425+
- `.spectrum-Textfield.is-keyboardFocused` - when the input is focused with the keyboard
1426+
- `.spectrum-Textfield.is-valid` - when the input has an explicit valid state
1427+
- `.spectrum-Textfield.is-invalid` - when the input has an explicit invalid state
1428+
1429+
#### Removal of `:valid`, `:invalid`, and `::placeholder`
1430+
1431+
Textfield no longer supports the CSS pseudo selectors [`:invalid`](https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid) and [`:value`](https://developer.mozilla.org/en-US/docs/Web/CSS/:valid).
1432+
1433+
Using these selectors is an anti-pattern that complicates form validation techniques by making inputs appear invalid immediately, not after use interaction. Please apply `.is-valid` and `.is-invalid` to the outer `div.spectrum-Textfield` element instead.
1434+
1435+
#### Variants
1436+
1437+
Variants must be applied to the parent element, i.e. `.spectrum-Textfield.spectrum-Textfield--quiet` or `.spectrum-Textfield.spectrum-Textfield--multiline`. The `<input>` will be styled appropriately.
1438+
13371439
### 🛑 BREAKING CHANGES
13381440

13391441
- remove support for .is-focused on .spectrum-Textfield-input

0 commit comments

Comments
 (0)