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
docs: fix and document use of keyboard focus classes on text fields
Our Storybook was adding the keyboard focus class on click, which isn't
the intended design. Click focus and focused by use of a keyboard have
different styles. This update stops the class from being applied on
click, and documents how the class should be added by the
implementation.
* A text area is multi-line text field using the `<textarea>` element that lets a user input a longer amount of text than a standard text field. It can include all of the standard validation options supported by the text field component.
11
-
*/
12
-
11
+
*/
13
12
exportdefault{
14
13
title: "Text area",
15
14
component: "TextArea",
@@ -52,7 +51,7 @@ CharacterCount.parameters = {
52
51
53
52
/**
54
53
* A text area in a disabled state shows that an input field exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that a field may become available later.
55
-
*/
54
+
*/
56
55
exportconstDisabled=Template.bind({});
57
56
Disabled.tags=["!dev"];
58
57
Disabled.args={
@@ -66,7 +65,7 @@ Disabled.parameters = {
66
65
* A text area can have [help text](/docs/components-help-text--docs) below the field to give extra context or instruction about what a user should input in the field. The help text area has two options: a description and an error message. The description communicates a hint or helpful information, such as specific requirements for correctly filling out the field. The error message communicates an error for when the field requirements aren’t met, prompting a user to adjust what they had originally input.
67
66
*
68
67
* Instead of placeholder text, use the help text description to convey requirements or to show any formatting examples that would help user comprehension. Putting instructions for how to complete an input, requirements, or any other essential information into placeholder text is not accessible.
* Text area has a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed.
* Side labels are most useful when vertical space is limited.
101
-
*/
100
+
*/
102
101
exportconstSideLabel=Template.bind({});
103
102
SideLabel.tags=["!dev"];
104
103
SideLabel.args={
@@ -112,10 +111,9 @@ SideLabel.parameters = {
112
111
chromatic: {disableSnapshot: true}
113
112
};
114
113
115
-
116
114
/**
117
115
* Text area can display a validation icon when the text entry is expected to conform to a specific format (e.g., email address, credit card number, password creation requirements, etc.). The icon appears as soon as a user types a valid entry in the field.
118
-
*/
116
+
*/
119
117
exportconstValidation=Template.bind({});
120
118
Validation.tags=["!dev"];
121
119
Validation.args={
@@ -126,7 +124,6 @@ Validation.parameters = {
126
124
};
127
125
Validation.storyName="Validation icon";
128
126
129
-
130
127
exportconstSizing=(args,context)=>Sizes({
131
128
Template: Template,
132
129
withHeading: false,
@@ -142,6 +139,19 @@ Sizing.parameters = {
142
139
chromatic: {disableSnapshot: true}
143
140
};
144
141
142
+
/**
143
+
* When the text area was focused using the keyboard (e.g. with the tab key), the implementation must add the `is-keyboardFocused` class, which
144
+
* displays the focus indicator. This indicator should not appear on focus from a click or tap.
* Text fields should always have a label. In rare cases where context is sufficient and an accessibility expert has reviewed the design, the label could be undefined. These text fields without a visible label should still include an aria-label in HTML (depending on the context, “aria-label” or “aria-labelledby”).
146
-
*/
146
+
*/
147
147
148
148
exportconstDefault=TextFieldGroup.bind({});
149
149
Default.tags=["!autodocs"];
@@ -160,7 +160,7 @@ Standard.parameters = {
160
160
161
161
/**
162
162
* Text fields can display a character count indicator when the length of the text entry needs to be kept under a predefined value. Character count indicators can be used in conjunction with other indicators (validation icon, “optional” or “required” indicators) when necessary.
163
-
*/
163
+
*/
164
164
exportconstCharacterCount=Template.bind({});
165
165
CharacterCount.tags=["!dev"];
166
166
CharacterCount.args={
@@ -174,7 +174,7 @@ CharacterCount.parameters = {
174
174
175
175
/**
176
176
* A text field in a disabled state shows that an input field exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that a field may become available later.
177
-
*/
177
+
*/
178
178
exportconstDisabled=Template.bind({});
179
179
Disabled.tags=["!dev"];
180
180
Disabled.args={
@@ -188,7 +188,7 @@ Disabled.parameters = {
188
188
* A text field can have [help text](/docs/components-help-text--docs) below the field to give extra context or instruction about what a user should input in the field. The help text area has two options: a description and an error message. The description communicates a hint or helpful information, such as specific requirements for correctly filling out the field. The error message communicates an error for when the field requirements aren’t met, prompting a user to adjust what they had originally input.
189
189
*
190
190
* Instead of placeholder text, use the help text description to convey requirements or to show any formatting examples that would help user comprehension. Putting instructions for how to complete an input, requirements, or any other essential information into placeholder text is not accessible.
191
-
*/
191
+
*/
192
192
exportconstHelpText=HelpTextOptions.bind({});
193
193
HelpText.tags=["!dev"];
194
194
HelpText.parameters={
@@ -197,7 +197,7 @@ HelpText.parameters = {
197
197
198
198
/**
199
199
* Quiet text fields can have no visible background. This style works best when a clear layout (vertical stack, table, grid) makes it easy to parse. Too many quiet components in a small space can be hard to read.
200
-
*/
200
+
*/
201
201
exportconstQuiet=TextFieldOptions.bind({});
202
202
Quiet.tags=["!dev"];
203
203
Quiet.args={
@@ -210,7 +210,7 @@ Quiet.parameters = {
210
210
211
211
/**
212
212
* Text fields have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed.
* Side labels are most useful when vertical space is limited.
227
-
*/
227
+
*/
228
228
exportconstSideLabel=Template.bind({});
229
229
SideLabel.tags=["!dev"];
230
230
SideLabel.args={
@@ -254,7 +254,7 @@ Sizing.parameters = {
254
254
255
255
/**
256
256
* Text fields can display a validation icon when the text entry is expected to conform to a specific format (e.g., email address, credit card number, password creation requirements, etc.). The icon appears as soon as a user types a valid entry in the field.
257
-
*/
257
+
*/
258
258
exportconstValidation=Template.bind({});
259
259
Validation.tags=["!dev"];
260
260
Validation.args={
@@ -265,6 +265,18 @@ Validation.parameters = {
265
265
};
266
266
Validation.storyName="Validation icon";
267
267
268
+
/**
269
+
* When the text field was focused using the keyboard (e.g. with the tab key), the implementation must add the `is-keyboardFocused` class, which
270
+
* displays the focus indicator. This indicator should not appear on focus from a click or tap.
0 commit comments