Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 54c4b9a

Browse files
authored
Merge pull request #6017 from department-of-veterans-affairs/5985-details-plain-language
Apply plain language improvements to Details component guidance
2 parents d256a79 + 2e17cac commit 54c4b9a

3 files changed

Lines changed: 43 additions & 43 deletions

File tree

src/_components/details.md

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: component
33
title: Details
44
status: use-with-caution-candidate
5-
intro-text: "Details makes content easier to scan as it hides information that may not be applicable to all users or situations. We use the Details component to situate plain language help at the point of the process where it is most relevant."
5+
intro-text: "The Details component reveals optional, supporting information that isn't required for most users to complete a task. It is used to provide plain language help at the point where it is most relevant."
66
figma-link-web: https://www.figma.com/design/afurtw4iqQe6y4gXfNfkkk/VADS-Component-Library?node-id=42924-290
77
uswds-v3: default
88
web-component: va-details
@@ -12,7 +12,6 @@ uses_mermaid: true
1212
anchors:
1313
- anchor: Examples
1414
- anchor: Usage
15-
- anchor: Behavior
1615
- anchor: Code usage
1716
- anchor: Content considerations
1817
- anchor: Accessibility considerations
@@ -24,68 +23,68 @@ anchors:
2423

2524
### Default
2625

27-
{% include storybook-preview.html story="components-va-details--default" link_text="va-details default" %}
26+
{% include storybook-preview.html story="components-va-details--default" link_text="va-details default" %}
2827

2928
### Different widths
30-
Use the Details component with a reduced width when you need the Details component to have less visual space on the page.
29+
Use a reduced width when you need Details to take up less space on the page.
3130

32-
{% include storybook-preview.html story="components-va-details--widths" link_text="va-details widths" %}
31+
{% include storybook-preview.html story="components-va-details--widths" link_text="va-details widths" %}
3332

3433
## Usage
3534

3635
### When to use Details
3736

38-
* **Revealing helpful background information**: When you have additional information you want to convey about an application, process, or a step or question in a form that is not critical. This component should be used in instances where a more prominent [Alert]({{ site.baseurl }}/components/alert) would not be appropriate.
39-
* **Clarifying outcomes for an input**: In cases where a person's input can have large or complicated impact on outcomes we use contextual help in Details to locate expanded guidance next to the relevant interaction.
40-
* **Information closely tied to an input.** Use this component over an [Accordion]({{ site.baseurl }}/components/accordion) when the content is closely tied to a particular message or input on the screen. If the content is more tangentially related then use an Accordion.
41-
* **Clarifying a form question**: If a form question needs clarification, and that clarification is brief, use Details. The lighter design prevents breaking up the visual progression as the user navigates the form. These can also serve as alternative to where accordions feel too heavy. Be sure to review the [hint text guidance]({{ site.baseurl }}/components/form/label#hint-text) for implementation details. If a form is a conversation, Details would be considered an aside. (This <a href="https://blog.navapbc.com/structuring-a-complex-eligibility-form-for-healthcare-gov-37d79a5ad6">case study on structuring complex health care questions for healthcare.gov</a> goes into greater detail on how to structure your form as a conversation.)
37+
* **Revealing helpful background information.** Use this component when you have additional information about an application, process, or form step that isn't critical. Use this component in instances where a more prominent [Alert]({{ site.baseurl }}/components/alert) wouldn't be appropriate.
38+
* **Explaining the impact of a choice.** If a user's answer will significantly affect their results or next steps, use Details to put that explanation right next to the relevant field.
39+
* **Information closely tied to an input.** Use this component over an [Accordion]({{ site.baseurl }}/components/accordion) when the content is closely tied to a particular message or input on the screen. If the content is only loosely related, use an Accordion instead.
40+
* **Clarifying a form question.** If a form question needs clarification, and that clarification is brief, use Details. The lighter design doesn't interrupt the flow of the form. These can also serve as an alternative when accordions feel too heavy or when hint text isn't enough. Be sure to review the [hint text guidance]({{ site.baseurl }}/components/form/label#hint-text) for more information.
4241
* **Content that can be organized under the current heading.** If you have additional content that provides context and makes sense under the same heading as the content nearby.
43-
* **Information not applicable to all**: Details can hide details that may not be applicable to all users.
42+
* **Information not applicable to all.** The Details component can hide information that doesn't apply to all users.
4443

4544
### When to consider something else
4645

47-
* **Accordions for a series**: If you have a series of content in the body of a page and outside of a form or tool then an [Accordion]({{ site.baseurl }}/components/accordion) is preferred. For example, if you have a series of questions as part of an FAQ section or a set of options for payment that each have additional details.
48-
* **Too much content**: Only include critical information inside this component. This includes form fields that require a lot of explanation. Link to another page, consider an [Accordion]({{ site.baseurl }}/components/accordion), or shorten the content. Collaborate with a member of the Content and IA team to edit content and explore alternatives.
49-
* **Required content**: If the majority of people need the content to accomplish the main task then it should not be hidden from view.
50-
* **Content organized under a new heading.** If you have enough content that it makes sense to organize under a new heading that does not make sense under the same heading as the content nearby then use an [Accordion]({{ site.baseurl }}/components/accordion).
51-
* **Error messages or other immediate actions**: Do not use this component for error messages or other critical or timely information.
52-
* **Inside Alerts**: Use this component inside an [Alert]({{ site.baseurl }}/components/alert) only as a last resort and if approved in the Collaboration Cycle. Instead use the [Alert - Expandable]({{ site.baseurl }}/components/alert/alert-expandable) component, especially when the Alert is within the page content and not at the top of the page.
53-
* **Floating in space**: Try to avoid using Details outside of the flow of the page, unattached to a section of content or another component. For example, there are instances of Details between a h1 and a Card. See [placement](#placement) for more.
46+
* **Accordions for a series.** If you have a series of content in the body of a page and outside of a form or tool, use an [Accordion]({{ site.baseurl }}/components/accordion) instead. For example, a series of FAQ questions or a set of payment options that each have additional information.
47+
* **Too much content.** Only include critical information inside this component. This includes form fields that require a lot of explanation. Link to another page, consider an [Accordion]({{ site.baseurl }}/components/accordion), or shorten the content. Collaborate with a member of the Content and Information Architecture (IA) team to edit content and explore alternatives.
48+
* **Required content.** If most people need the content to accomplish the main task, don't hide it from view.
49+
* **Content organized under a new heading.** If the content warrants a new heading that doesn't belong under the same heading as nearby content, use an [Accordion]({{ site.baseurl }}/components/accordion) instead.
50+
* **Error messages or other immediate actions.** Don't use this component for error messages or other critical or timely information.
51+
* **Inside Alerts.** Use this component inside an [Alert]({{ site.baseurl }}/components/alert) only as a last resort and if approved in the Collaboration Cycle. Instead use the [Alert - Expandable]({{ site.baseurl }}/components/alert/alert-expandable) component, especially when the Alert is within the page content and not at the top of the page.
52+
* **Floating in space.** Try to avoid using Details outside of the flow of the page, unattached to a section of content or another component. See [placement](#placement) guidance on this page for more information.
5453

5554
{% include content/details-vs-hint-text-vs-accordion.md %}
5655

57-
## Behavior
56+
### How this component works
5857

5958
The Details component uses native HTML `<details>` and `<summary>` elements, which provide several advantages over JavaScript-based implementations:
6059

61-
* **Searchable and discoverable content**: Browser search (Ctrl+F or Cmd+F) can find text inside collapsed Details, and search engines can index the content for better search engine optimization (SEO).
62-
* **Better performance and reliability**: No JavaScript required for basic functionality, improving load times and ensuring content works even when JavaScript fails.
63-
* **Enhanced accessibility**: Native semantic meaning provides better assistive technology support without additional ARIA attributes, following web standards universally supported across browsers.
60+
* **Searchable and discoverable content.** Browser search (Ctrl+F or Cmd+F) can find text inside collapsed Details, and search engines can index the content for better search engine optimization (SEO).
61+
* **Better performance and reliability.** This component requires no JavaScript for basic functionality, improving load times and ensuring content works even when JavaScript fails.
62+
* **Enhanced accessibility.** Native semantic meaning provides better assistive technology support without additional ARIA attributes, following web standards universally supported across browsers.
6463

6564
### Placement
6665

67-
The following are places where Details can be used:
66+
You can use Details in these places:
6867

69-
* After a header (h2, h3, h4) or paragraph to provide orthogonal details or provide an answer to a common question.
70-
* Within a [Process list]({{ site.baseurl }}/components/process-list) to shorten the length of content within a step.
71-
* Within, or at the end, of a [Form]({{ site.baseurl }}/components/form/label#with-details) to provide additional help text.
72-
* Whenever there is a chance to enhance the understanding a user has about a particular choice.
68+
* After a header (h2, h3, or h4) or paragraph to provide supplementary information or answer a common question
69+
* Within a [Process list]({{ site.baseurl }}/components/process-list) to shorten the length of content within a step
70+
* Within, or at the end, of a [Form]({{ site.baseurl }}/components/form/label#with-details) to provide additional help text
71+
* When you need to help users understand a particular choice
7372

74-
**Note:** Placement does not alter [content considerations](#content-considerations) in any way.
73+
**Note:** Placement of Details doesn't change the [content considerations](#content-considerations) for this component.
7574

7675
{% include component-docs.html component_name=page.web-component %}
7776

7877
## Content considerations
7978

80-
* **Use a statement, rather than a question.** Use a statement (like "Why we ask for this information") rather than a question (like "Why does VA ask for this information?") for the title (trigger text) of the component. Because we use questions to gather information from people in our forms, structuring additional information as questions as well can cause confusion. Keep titles to a single sentence or sentence fragment with no ending punctuation.
81-
* **Limit the amount of expanded content.** Limit content to fewer than 500 characters (with spaces) when possible. If you need to provide more information, consider using one or more [Accordions]({{ site.baseurl }}/components/accordion) instead or providing a brief overview in the Details component with a link to another page with more information. Collaborate with a member of the Content and Information Architecture team to edit content and explore alternatives.
82-
* **Use lists in expanded content as needed.** To make content easier to scan, we encourage you to use numbered (also called "ordered") and bulleted (also called "unordered") lists as needed.
79+
* **Use a statement, rather than a question.** Use a statement (like "Why we ask for this information") rather than a question (like "Why does VA ask for this information?") for the label of the component. Framing help text as questions can confuse people who expect questions to ask for their input. Keep titles to a single sentence or sentence fragment with no ending punctuation.
80+
* **Limit the amount of expanded content.** Limit content to fewer than 500 characters (with spaces) when possible. If you need to provide more information, use 1 or more [Accordions]({{ site.baseurl }}/components/accordion) instead. You can also include a brief overview in Details with a link to a page that has more detail. Collaborate with a member of the Content and Information Architecture team to edit content and explore alternatives.
81+
* **Use lists in expanded content as needed.** Use numbered (ordered) and bulleted (unordered) lists to make content easier to scan.
8382

8483
## Accessibility considerations
8584

86-
* **Wrap content in HTML elements.** All text content inside `va-details` must be wrapped in an appropriate HTML element such as `<p>`, `<span>`, or `<div>`. Some screen readers, particularly NVDA, may ignore unwrapped plain text. For example, use `<p>This is the content.</p>` instead of placing text directly inside the component without a wrapper element.
87-
* **Do not add ARIA roles or state attributes.** The details component uses the `<details>` HTML element that exposes expanded/collapsed state and interactive behavior natively. Adding any `role="button"` or `aria-expanded` is redundant and can create conflicting announcements in assistive technology.
88-
* **Keyboard interaction is provided natively.** Users must be able to tab to the component, toggle it using Enter or Space, and if there are interactive elements in the component, the next tab takes them to those interactive elements.
85+
* **Wrap content in HTML elements.** Place all text content inside `va-details` within an appropriate HTML element such as `<p>`, `<span>`, or `<div>`. Some screen readers, particularly NVDA, may ignore unwrapped plain text. For example, use `<p>This is the content.</p>` instead of placing text directly inside the component without a wrapper element.
86+
* **Don't add ARIA roles or state attributes.** The Details component uses the `<details>` HTML element that exposes expanded/collapsed state and interactive behavior natively. Adding any `role="button"` or `aria-expanded` is redundant and can create conflicting announcements in assistive technology.
87+
* **Native keyboard interaction.** Users can tab to the component and toggle it open or closed with Enter or Space. If the component contains interactive elements, the next Tab keypress moves focus to those elements.
8988

9089
## Related
9190

src/_includes/content/details-vs-hint-text-vs-accordion.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
When deciding which component to use inside a form, consider how essential the information is and how it relates to nearby content:
44

5-
* **Essential information for form fields:** Use {% if page.url == '/components/form/label' %}hint text{% else %}[hint text]({{ site.baseurl }}/components/form/label#hint-text){% endif %} for brief, critical information that most users need to complete a field successfully.
6-
* **Helpful context tied to specific content:** Use {% if page.url == '/components/details' %}Details{% else %}[Details]({{ site.baseurl }}/components/details){% endif %} for brief explanations related to nearby form fields or sections that users can access when needed.
7-
* **Substantial standalone information:** Use {% if page.url == '/components/accordion' %}Accordion{% else %}[Accordion]({{ site.baseurl }}/components/accordion){% endif %} for lengthy content that deserves its own heading or multiple related topics like FAQ sections.
5+
* **Essential information for form fields.** Use {% if page.url == '/components/form/label' %}hint text{% else %}[hint text]({{ site.baseurl }}/components/form/label#hint-text){% endif %} for brief, critical information that most users need to complete a field successfully.
6+
* **Helpful context tied to specific content.** Use {% if page.url == '/components/details' %}Details{% else %}[Details]({{ site.baseurl }}/components/details){% endif %} for brief explanations related to nearby form fields or sections that users can access when needed.
7+
* **Substantial standalone information.** Use {% if page.url == '/components/accordion' %}Accordion{% else %}[Accordion]({{ site.baseurl }}/components/accordion){% endif %} for lengthy content that deserves its own heading or multiple related topics like FAQ sections.
88

9-
### Decision tree
9+
#### Decision tree
1010

1111
<div class="mermaid-width mermaid-comparison">
1212
<div class="sr-only">
@@ -43,25 +43,27 @@ flowchart TD
4343

4444
<h4>Text-based decision guide</h4>
4545

46-
<ol>
46+
<ol style="font-size:1rem;">
47+
<!-- fontsize defined because the details component is resizing this text to 16.96px -->
48+
4749
<li><strong>Is this information essential for completing a form field?</strong>
4850
<ul>
49-
<li><strong>Yes</strong> (Field requirements, input patterns) → <em>Use hint text</em></li>
51+
<li><strong>Yes</strong> (Field requirements, input patterns) → Use hint text</li>
5052
<li><strong>No</strong> (Background context, helpful clarifications) → Continue to question 2</li>
5153
</ul>
5254
</li>
5355

5456
<li><strong>Is content related to a nearby form field or section?</strong>
5557
<ul>
5658
<li><strong>Yes</strong> (Why we ask questions, field-specific help) → Continue to question 3</li>
57-
<li><strong>No</strong> (General information, standalone topics) → <em>Use Accordion</em></li>
59+
<li><strong>No</strong> (General information, standalone topics) → Use Accordion</li>
5860
</ul>
5961
</li>
6062

6163
<li><strong>Is content brief and doesn't need a heading?</strong>
6264
<ul>
63-
<li><strong>Yes</strong> (Short explanations, simple clarifications) → <em>Use Details</em></li>
64-
<li><strong>No</strong> (Long content, complex explanations) → <em>Use Accordion</em></li>
65+
<li><strong>Yes</strong> (Short explanations, simple clarifications) → Use Details</li>
66+
<li><strong>No</strong> (Long content, complex explanations) → Use Accordion</li>
6567
</ul>
6668
</li>
6769
</ol>

src/assets/stylesheets/application.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ these can be removed along with an update to how classes are generated in color-
248248
}
249249

250250
.mermaid-chart-caption {
251-
font-style: italic;
252251
text-align: center;
253252
max-width: 768px;
254253
margin: 0 auto;

0 commit comments

Comments
 (0)