Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USWDS-Site: Fix component pages from audit (Phase 2) #2162

Merged
merged 48 commits into from Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a1d0f71
Add formatting to footer variant classes
amyleadem Jun 30, 2023
b617e74
Add bolded headers to header accessibility
amyleadem Jun 30, 2023
9c8865b
Remove content unrelated to header
amyleadem Jun 30, 2023
931992f
Update icon list variants descriptions
amyleadem Jun 30, 2023
9af346d
Fix formatting on icon accessibility code samples
amyleadem Jun 30, 2023
6e090bd
Add documentation for usa-input-group--success
amyleadem Jun 30, 2023
99459b4
Add backticks to for attribute
amyleadem Jun 30, 2023
ec39db4
Add clarity to hint text header
amyleadem Jun 30, 2023
1d68936
Add missing space
amyleadem Jun 30, 2023
e33193f
Add clarity to hide icons from screen readers section
amyleadem Jun 30, 2023
f55e4c6
Add periods to class names
amyleadem Jun 30, 2023
b73717c
Add clarity to input prefix implementation section
amyleadem Jun 30, 2023
f11342b
Remove redundant quotes
amyleadem Jun 30, 2023
e7a5b9f
Add missing usa-link dependencies
amyleadem Jun 30, 2023
693b9f0
Update code styling for link encoding example
amyleadem Jun 30, 2023
a9048f8
Add backticks to id on modal accessibility
amyleadem Jul 5, 2023
3f8cc0d
Add documentation for usa-list--unstyled variant
amyleadem Jul 5, 2023
525c9b7
Add bolded statements to list implementation
amyleadem Jul 5, 2023
a93b439
Small copy edits to modal implementation section
amyleadem Jul 5, 2023
43654be
Update text to say 'older versions of' edge
amyleadem Jul 5, 2023
1af64ed
Add changelog items for #2162
amyleadem Jul 5, 2023
26c92c4
Standardize code presentation
amyleadem Jul 5, 2023
06c6c55
Remove note about file input in iOS.
amyleadem Jul 5, 2023
53841a8
Add clarity to icon list variant copy
amyleadem Jul 5, 2023
afe572d
Remove reference to <a> tags and JS from modal
amyleadem Jul 5, 2023
fbd764b
Update header guidance
amyleadem Jul 5, 2023
70391d9
Remove extra word from spanish identifier section
amyleadem Jul 5, 2023
7a3388c
Fix incomplete sentence for identifier background color
amyleadem Jul 5, 2023
4c776b8
Remove language selector note about links
amyleadem Jul 5, 2023
46e5a90
Add site.baseurl to component links
amyleadem Jul 5, 2023
769ad3a
Add period to usa-link--external
amyleadem Jul 5, 2023
ceef908
Add clarity to modal title section
amyleadem Jul 5, 2023
0b567e0
Update changelog entry fror 2162
amyleadem Jul 5, 2023
16c7554
Added changelog for 2162
amyleadem Jul 5, 2023
29e5c33
Fix typo
amyleadem Jul 5, 2023
47eacd6
Update usability.md
sarah-sch Jul 11, 2023
7cacf39
Update header.html
sarah-sch Jul 11, 2023
2591df0
Update header.html
sarah-sch Jul 11, 2023
190e3a6
Add clarity to file input accept attribute section
amyleadem Jul 11, 2023
1825a35
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Jul 11, 2023
4745cac
Add clarity to modal implementation copy
amyleadem Jul 12, 2023
a7e3b52
Restore note about using <a> for JS fallback
amyleadem Jul 14, 2023
f4c3ed0
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Jul 14, 2023
c142315
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Jul 21, 2023
08ce1df
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Aug 3, 2023
8f5bac8
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Nov 20, 2023
3afcf63
Update changelog dates
amyleadem Nov 20, 2023
fe79cc9
Merge branch 'main' of https://github.com/uswds/uswds-site into al-co…
amyleadem Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions _components/file-input/guidance/accessibility.md
@@ -1,2 +1,2 @@
- **Use proper labels and attributes.** Each file input should have a `<label>`. Associate the two by matching the `<label>`’s for attribute to the `<input>`’s `id` attribute.
- **Use as a progressive enhancement.** The file input component should be a progressive enhancement of `<input type="file" />`. If the component doesn't initialize, it should still work and appear like a standard `file` input.
- **Use proper labels and attributes.** Each file input should have a `label` element. Associate the label to your input by defining the value of the label’s `for` attribute with the input’s `id`.
- **Use as a progressive enhancement.** The file input component should be a progressive enhancement of `<input type="file" />`. If the component doesn't initialize, it should still work and appear like a standard `file` input.
4 changes: 2 additions & 2 deletions _components/file-input/guidance/implementation.md
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
@@ -1,5 +1,5 @@
- **Initialization properties.** JavaScript will create most elements for file input. To get a file input to initialize, add the class name `usa-file-input` to `<input type="file" />`.
- **Interaction.** When a user selects or drags documents to the file input, the file name and a thumbnail preview are listed.
- **Using the `accept` attribute.** You can allow certain files by placing an accept attribute on the `<input/>`. If a file type is not accepted, the file will not be attached and the file input will display a message. [Learn more about the accept attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) [mozilla.org].
- **Internet Explorer/Edge.** These browsers do not support dragging items to a file input. Instructions to drag files are removed for these browsers.
- **Limit accepted file types with the `accept` attribute.** Add the `accept` attribute to the `input` element when you want to limit the types of files your input can accept. If a user selects a file that does not match the specified type, the file will not be attached and the file input will display an error message. [Learn more about the accept attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) [mozilla.org].
- **Internet Explorer and older versions of Edge.** These browsers do not support dragging items to a file input. Instructions to drag files are removed for these browsers.
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this note still needed? Wondering if it can be considered outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, does the file-input component remove the drag instructions if implemented on these browsers?

If it's still a feature of the component, I feel we should leave it.

- **Customizing the error message.** Add the data attribute `data-errorMessage` to `usa-file-input` to include a custom error message.
4 changes: 2 additions & 2 deletions _components/file-input/guidance/usability.md
@@ -1,3 +1,3 @@
- **Allow multiple file formats.** Not everyone has access to the same software. Be flexible with file types to avoid unnecessary software requirements.
- **Prefer one file per input.** Some users might not know how to select multiple files in a file browser. Additionally, iOS does not allow multiple-file selection using the Files app.
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note
Removed the iOS note because I was able to select multiple files and images in iOS.

- **Highlight input restrictions.** Use `usa-hint` to be clear about any file restrictions, such as document types or file size.
- **Prefer one file per input.** Some users might not know how to select multiple files in a file browser.
- **Use hint text to highlight input restrictions.** Create an element with the `usa-hint` class to explain any file restrictions, such as document types or file size.
@@ -1,3 +1,3 @@
- **Documents are optional.** Avoid asking users to provide documents if you don't require them.
- **Asynchronous upload.** The file input component doesn't support asynchronous uploading. Files are POSTed only on form submission.
- **Asking for large files.** Be mindful that some users might have limited connectivity or data plans.
- **Asynchronous upload.** The file input component doesn't support asynchronous uploading. Files will `POST` only on form submission.
- **Asking for large files.** Be mindful that some users might have limited connectivity or data plans.
4 changes: 2 additions & 2 deletions _components/footer/footer.md
Expand Up @@ -28,9 +28,9 @@ tags:
title: Footer
type: component
variants:
- variant: usa-footer--big
- variant: "`.usa-footer--big`"
description: A multi-column footer that expands and collapses on mobile.
- variant: usa-footer--slim
- variant: "`.usa-footer--slim`"
description: A compact version of the footer.
changelog:
key: component-footer
Expand Down
79 changes: 20 additions & 59 deletions _components/header/header.html
Expand Up @@ -34,14 +34,8 @@
key: component-header
in_page_nav: false
---

<h2>When to use a header component</h2>
<ul class="usa-content-list">
<li>
<strong>Use the gov banner on all federal websites.</strong> We recommend
that all federal government websites include the “official government website”
banner and a logo or site name.
</li>
Comment on lines -40 to -44
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note
I removed notes about the banner component on the header page because the content seemed outdated and I worried that mixing component guidance might lead to confusion.

If we want to keep something here - maybe it would be good to convert some of this content to a site-note that recommends using both the banner and logo/site name on your page?

<li>
<strong>Most websites require header navigation.</strong> Most websites
require some form of navigation to help users find the information they
Expand Down Expand Up @@ -99,85 +93,52 @@ <h2>Header usability</h2>
<h2 class="usa-heading heading-margin-alt">Header accessibility</h2>
<ul class="usa-content-list">
<li>
Include skip navigation links to allow users with screen readers to bypass
long navigation lists. Make sure you include an id at the beginning of your
main content and that it matches the skipnav link. Find more <a href="http://webaim.org/techniques/skipnav/">information on these links</a> at WebAIM.

<strong>Add a skip navigation link before the header.</strong> Include skip navigation links to allow those using
screen readers to bypass long navigation lists. Make sure you include an <code>id</code> at the beginning of your
main content and that it matches the skip navigation link. Find more <a
href="http://webaim.org/techniques/skipnav/">information on skip navigation links</a> at WebAIM.
</li>
<li>
Include tab focus for all top-level navigation navigation items — this feature will
allow keyboard-reliant users to easily navigate interactive items.
<strong>Ensure your horizontal navigation is keyboard compatible.</strong> Test to make sure
users can use <code>Tab</code> to navigate and <code>Space</code> (or <code>Enter</code>) to open pages.
</li>
<li>
Ensure your horizontal navigation is keyboard compatible; test to make sure
users can use Tab to navigate and Space (or Enter) to open pages.
<strong>Include tab focus for all top-level navigation navigation items.</strong> This feature will
allow keyboard-reliant users to easily navigate interactive items.
</li>
<li>
Avoid using hover to expand dropdown lists. Hover is difficult for some
<strong>Avoid using hover to expand dropdown lists.</strong> Hover is difficult for some
users and won't work on touch screens. Dropdowns should expand on click or
with keyboard navigation.
</li>
<li>
The Design System uses semantic header and nav elements with
<code>role="banner"</code> and <code>role="navigation"</code> respectively.
<code>role="banner"</code> is your masthead.
</li>
<li>
Comment on lines -121 to -125
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note
Removed this because we do not use either roles in our banner or header component examples.

You can use multiple nav elements for groups of navigation links, but you
should only use one <code>role="navigation"</code> for the main nav of a
page.
Comment on lines -126 to -128
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced this section with the "Add context by labelling your nav element." section. We do not use the navigation role in our code, and it seems unnecessary since we are using the semantic nav element.

Is there a reason we would want to redundantly declare the role? Should we keep this note in but specify it is only if you are not using the nav element?

<strong>Add context by labelling your nav element.</strong> If your page has more than one
<code>nav</code> element, use the <code>aria-label</code> attribute to help assistive technology users understand the purpose of the navigation.
</li>
<li>
Use lists for your nav links — doing so enables screen readers to decipher
header contents.
<strong>Use list elements for your navigation links.</strong> This helps screen reader users
navigate header content.
</li>
<li>
If you’re using a logo that’s an image rather than text, make sure you
include alternative text for screen readers.
<strong>Add alt text to your logo image.</strong> If you’re using a logo that’s an image rather than text, make sure
you include alternative text for screen readers.
</li>
<li>
If you’re using a logo that’s text, use an <code>em</code>, not an
<strong>Don't use an H1 for your logo.</strong> If you’re using a logo that’s text, use an <code>em</code>, not an
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking - is the bolded statement accurate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflects what's shown in example:
image

Default header preview

<code>h1</code>, unless it’s the homepage. Find more information here:
<a href="http://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/"
>http://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/.</a
>
<a
href="http://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/">http://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/.</a>
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is almost 13 years old. Is it still accurate? Do we want to keep it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This article isn't much newer, but I like the reasoning here:

The first heading on your site should be the one that best describes the content of your page. Sometimes this is your logo–but most of the time it’s not. 1

Footnotes

  1. https://www.fastcompany.com/3016894/should-your-tag-be-your-logo#:~:text=The%20first%20heading%20on%20your,organize%20information%20and%20orient%20users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm included to keep it because:

  • Link still works
  • Site is a good resource
  • Guidance reflects what's actually shown in USWDS header

</li>
</ul>

<h2>The “official government website” banner</h2>
<p>
We recommend that all federal government websites include the “official
government website” banner and a logo or site name. The banner clearly
identifies your website as part of the United States government, while a logo or
site name helps visitors understand who you are and what you do.
</p>
Comment on lines -147 to -153
Copy link
Contributor Author

@amyleadem amyleadem Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note
Removed this because it didn't apply to the header component.

<h3>Building with HTTPS</h3>
<p>
<a
href="https://18f.gsa.gov/2014/11/13/why-we-use-https-in-every-gov-website-we-make/"
>HTTPS is a best practice</a
>
for all websites: It’s secure, private, and fast, and search engines prefer
encrypted sites. But it’s especially important for government websites. The
.gov in government websites carries a lot of weight. The public expects the
contents of .gov websites to be official and accurate, and they expect any
information they submit to that website to be private. The U.S. CIO provides
guidance to implementing HTTPS for government websites at
<a href="https://https.cio.gov/">https://https.cio.gov/.</a>
</p>
Comment on lines -156 to -167
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it didn't feel like header-specific content. Is there a better spot for this content?


<h2>Further reading</h2>
<ul>
<li>
<a href="https://www.nngroup.com/articles/menu-design/"
>https://www.nngroup.com/articles/menu-design/</a
>
<a href="https://www.nngroup.com/articles/menu-design/">https://www.nngroup.com/articles/menu-design/</a>
</li>
<li>
<a
href="https://www.usertesting.com/blog/site-navigation-tree-testing"
>https://www.usertesting.com/blog/site-navigation-tree-testing</a
>
href="https://help.usertesting.com/hc/en-us/articles/115003372331-What-is-Tree-Testing">https://help.usertesting.com/hc/en-us/articles/115003372331-What-is-Tree-Testing</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old link just redirects to their blog home page. I found a post from them about tree testing, but I am not sure if it applies. Should we remove this or find another link?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep for now. Created a new issue to follow-up on this #2187.

</li>
</ul>

Expand Down
2 changes: 1 addition & 1 deletion _components/icon-list/guidance/accessibility.md
@@ -1,6 +1,6 @@
- **Don't rely on the icons alone to convey meaning.** Use text and context to establish the meaning of your list, and use the icon to reinforce that meaning as a progressive enhancement.
- **Use colors with accessible contrast.** While the icons in an icon list might be considered decorative progressive enhancement, aim for accessible AA contrast. This assures legibility on printed pages as well.
- **Hide most icons from screen readers.** This component uses the `aria-hidden="true"` and `role=”img”` because the icon used solely as visual progressive enhancement. It's meaning should be redundant with the list content.
- **Hide most icons from screen readers.** This component uses the `aria-hidden="true"` and `role=”img”` attributes because the icons are used solely as a visual progressive enhancement. The icon's meaning is redundant with the list content.
- **If you wish to expose icons to screen readers:**
- Provide descriptive text for each icon.
- Remove the `aria-hidden="true"` attribute and add a `aria-labelledby` attribute with a value that matches the `id` of a title element added inside the svg.
Expand Down
2 changes: 1 addition & 1 deletion _components/icon-list/icon-list.md
Expand Up @@ -22,7 +22,7 @@ title: Icon list
type: component
variants:
- variant: "`.usa-icon-list--[color]`"
description: Change the color of all the list's icons by updating [color] to any one of the theme colors listed on the [color utilities](/utilities/color) page.
description: Change the color of all the list's icons by updating [color] to any [theme](/design-tokens/color/theme-tokens/) or [state](/design-tokens/color/state-tokens/) color token.
- variant: "`usa-icon-list--size-[size]`"
description: "Change the size of the text and icon by updating [size] to a [font size token](/design-tokens/typesetting/font-size/)."
- variant: "`[responsive_variant]:usa-icon-list--size-[size]`"
Expand Down
35 changes: 19 additions & 16 deletions _components/icon/guidance/accessibility.md
@@ -1,20 +1,23 @@
- **Hide decorative icons from screen readers.** Use the `aria-hidden="true"` and `role="img"` attributes if the icon is redundant and used solely as visual progressive enhancement as in the following code:
```html
<a href="https://twitter.com/uswds">
<svg class="usa-icon" aria-hidden="true" role="img">
<use xlink:href="/assets/img/sprite.svg#arrow_forward"></use>
</svg>
USWDS' Twitter account
</a>
```

```html
<a href="https://twitter.com/uswds">
<svg class="usa-icon" aria-hidden="true" role="img">
<use xlink:href="/assets/img/sprite.svg#arrow_forward"></use>
</svg>
USWDS' Twitter account
</a>
```

- **Provide descriptive text if a standalone icon has semantic meaning.** If you need to expose an icon to screen readers, remove the `aria-hidden="true"` attribute and add an `aria-labelledby` attribute with a value that matches the `id` of a `<title>` element added inside the SVG as in the following code:
```html
<a href="https://twitter.com/uswds">
<svg aria-labelledby="twitter-title" role="img">
<title id="twitter-title">USWDS' Twitter account</title>
<use xlink:href="/path/to/sprite.svg#twitter"></use>
</svg>
</a>
```

```html
<a href="https://twitter.com/uswds">
<svg aria-labelledby="twitter-title" role="img">
<title id="twitter-title">USWDS' Twitter account</title>
<use xlink:href="/path/to/sprite.svg#twitter"></use>
</svg>
</a>
```
- **Check for good color contrast.** Make sure that the icon has a minimum contrast ratio of 3:1 against its background. See [WCAG 2.1 Techniques: Ensuring that a contrast ratio of 3:1 is provided for icons](https://www.w3.org/WAI/WCAG21/Techniques/general/G207) for more information.
- **Place icons inside links.** If icons accompany a text link, place the icon inside the link to prevent the screen reader from announcing the link twice.
4 changes: 2 additions & 2 deletions _components/identifier/guidance/implementation.md
@@ -1,5 +1,5 @@
- **Except where noted, use the entire component without deletions or additions.** With rare exceptions, if you use the identifier, include the entire identifier. That is, don't delete sections or required links or change any link text beyond the customizations mentioned in the implementation section.
- **Use a background color darker than that of the footer.** color to anchor the identifier to the bottom of the page and distinguish it from other site content. Use primary or base family background colors of grade `80` or higher, or `black`.
- **Use a background color darker than that of the footer.** Anchor the identifier to the bottom of the page and distinguish it from other site content by adding a background color that is darker than the footer. Use primary or base family background colors of grade `80` or higher, or `black`.
- **Use an SVG logo if possible.** Ensure the logo is high resolution. We recommend using the SVG version of any logo if you have one. Otherwise, use an image that's at least 120 pixels tall.
- **Use logos intended for dark backgrounds if possible.** The identifier has a dark background. If your agency has a version of its logo intended for dark backgrounds, use that version.
- **Update the required links to point to the proper URLs.** The identifier includes links required of any federal website, and these links are specific to a department, agency, or website. We've linked each section below to the guidance on Digital.gov to provide further context.
Expand Down Expand Up @@ -31,6 +31,6 @@

Example: [https://www.dhs.gov/privacy-policy](https://www.dhs.gov/privacy-policy)

- **Use the Spanish version if for Spanish-language sites.** If you have an official Spanish-language website, use the Spanish version of the identifier.
- **Use the Spanish version for Spanish-language sites.** If you have an official Spanish-language website, use the Spanish version of the identifier.
- **Duplicate the logo element if using multiple logos.** If you're using multiple logos, duplicate the `usa-identifier__logo` element and link the image to your image source.
- **If applicable, include any taxpayer disclaimer after the standard text.** If the organization must provide a taxpayer expense disclaimer, include it following the "Official website" text, as a separate sentence. For example, "An official website of [Department]. Produced and published at taxpayer expense."
2 changes: 1 addition & 1 deletion _components/identifier/guidance/usability.md
@@ -1,5 +1,5 @@
- **Use the identifier component for required links.** If your site already includes the federally required links in its site footer, remove them in favor of the links in the identifier. This assures that site visitors find the required links in a consistent location from site to site.
- **Display the parent agency logo, not the product logo.** The identifier is meant to identify a website's parent agency as a complement to the site footer. Site-specific logos, like a product logo, should be in the site footer, not the identifier.
- **Display multiple parents and logos in hierarchical order.** If a site has more than one parent agency, you may display a reference and a logo for each parent in hierarchical order, highest first. For example,"An official website of [Grandparent Department] and [Parent Agency]".
- **Display multiple parents and logos in hierarchical order.** If a site has more than one parent agency, you may display a reference and a logo for each parent in hierarchical order, highest first. For example, "An official website of [Grandparent Department] and [Parent Agency]".
- **Avoid distraction.** The identifier appears on every page of your site. Choose background colors that fit with your site theme and avoid color combinations that draw excessive attention to the identifier.
- **Keep the text up-to-date.** Use the most current version of the identifier.
4 changes: 2 additions & 2 deletions _components/input-prefix-suffix/guidance/implementation.md
@@ -1,5 +1,5 @@
- **Placement.** Place the `.usa-input-prefix` before `.usa-input` and `.usa-input-suffix` after the `.usa-input`. Both elements are placed inside `.usa-input-group`.
- **Placement matters.** Place the `.usa-input-prefix` element _before_ the `.usa-input` element, and place the `.usa-input-suffix` element _after_ `.usa-input`. Both elements should be placed inside `.usa-input-group`.

- **Use text or icons.** Input prefixes and suffixes can accept either plain text or [icons]({{ site.baseurl }}/components/icon/).

- **Validation.** Place input validation classes on `usa-input-group`.
- **Use validation styles.** Place [input validation classes](#component-variants-input-prefix-suffix) on `usa-input-group`.
6 changes: 4 additions & 2 deletions _components/input-prefix-suffix/input-prefix-suffix.md
Expand Up @@ -28,9 +28,11 @@ tags:
title: Input prefix or suffix
type: component
variants:
- variant: "`usa-input-group--error`"
- variant: "`.usa-input-group--error`"
description: Displays an input group error state.
- variant: "`usa-input-group--[width]`"
- variant: "`.usa-input-group--success`"
description: Displays an input group success state.
- variant: "`.usa-input-group--[width]`"
description: Displays an input group at a specific width. Accepts `2xs` (5ex), `xs` (9ex), `sm` or `small` (13ex), `md` or `medium` (20ex), `lg` (30ex), `xl` (40ex), and `2xl` (50ex).
changelog:
key: component-input-prefix-suffix
Expand Down