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

Commit 157c9cf

Browse files
authored
Merge pull request #5650 from department-of-veterans-affairs/fix-details-merge-conflicts
va-details: Add Details component
2 parents aa163f7 + 4432a69 commit 157c9cf

30 files changed

Lines changed: 312 additions & 98 deletions

src/_accessibility/accessibility-annotations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ The second part of Example 2 that the designer annotated was the address input a
225225

226226
In theory, since the whole address input is a pattern in the design system, it could have been handled with the “Pattern” annotation component and details card.
227227

228-
However, since this was the first time the designer was collaborating with their developers, they wanted to provide extra details. The designer decided to annotate the Learn more about… using the Additional info component, as well as the individual address inputs to provide additional information on proper elements and autocomplete features.
228+
However, since this was the first time the designer was collaborating with their developers, they wanted to provide extra details. The designer decided to annotate the "Learn more about…" using the Details component, as well as the individual address inputs to provide additional information on proper elements and autocomplete features.
229229

230230
## Make annotations a communication tool
231231

src/_components/accordion.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ uswds-v3: default
88
web-component: va-accordion
99
web: true
1010
mobile-app: false
11+
uses_mermaid: true
1112
anchors:
1213
- anchor: Examples
1314
- anchor: Usage
@@ -65,10 +66,12 @@ anchors:
6566

6667
#### Additional reasons to consider something else
6768

68-
* **Users would benefit from seeing additional context for a discrete piece of content.** Use the [Additional info]({{ site.baseurl }}/components/additional-info) component instead to leverage show/hide functionality, especially in a form.
69-
* **Content that can be organized under the current heading.** Use the [Additional info]({{ site.baseurl }}/components/additional-info) component if you have additional content that provides context and makes sense under the same heading as the content nearby.
69+
* **Users would benefit from seeing additional context for a discrete piece of content.** Use the [Details]({{ site.baseurl }}/components/details) component instead to leverage show/hide functionality, especially in a form.
70+
* **Content that can be organized under the current heading.** Use the [Details]({{ site.baseurl }}/components/details) component if you have additional content that provides context and makes sense under the same heading as the content nearby.
7071
* **Required content**: If the majority of people need the content to accomplish the main task then it should not be hidden from view.
7172

73+
{% include content/details-vs-hint-text-vs-accordion.md %}
74+
7275
### Behavior
7376

7477
* Allow users to click anywhere in the header area to expand or collapse the content; a larger target is easier to manipulate.
@@ -92,6 +95,6 @@ anchors:
9295
9396
## Related
9497

95-
* [Additional info]({{ site.baseurl }}/components/additional-info)
98+
* [Details]({{ site.baseurl }}/components/details)
9699

97-
{% include _component-checklist.html component_name=page.web-component %}
100+
{% include _component-checklist.html component_name=page.web-component %}

src/_components/additional-info.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
layout: component
33
title: Additional info
4-
intro-text: "Additional info makes content easier to scan as it hides information that may not be applicable to all users or situations. We use the Additional info component to situate plain language help at the point of the process where it is most relevant."
4+
status: use-with-caution-candidate
5+
intro-text: "Additional info makes content easier to scan as it hides information that may not be applicable to all users or situations. Use this component to situate plain language help at the point of the process where it is most relevant."
56
figma-link-web: https://www.figma.com/file/JDFpGLIojfuQwANXScQjqe/VADS-Component-Examples?type=design&node-id=1350%3A22760&mode=design&t=TiJHClaf3VQ6wU6B-1
67
uswds-v3: default
78
web-component: va-additional-info

src/_components/alert/alert-expandable.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ anchors:
4545
### When to consider something else
4646

4747
* **User feedback.** Use the [Alert]({{ site.baseurl }}/components/alert) component when responding to an action taken by a user such as submitting a form.
48-
* **Clarifying background information.** Use the [Additional info]({{ site.baseurl }}/components/additional-info) component when clarifying outcomes for an input or a form question as well as providing background information. Keep in mind that Alert - Expandable should warrant an alert and be used sparingly. The value of any type of alert is diminished if the page is littered with alerts of equal weight.
48+
* **Clarifying background information.** Use the [Details]({{ site.baseurl }}/components/details) component when clarifying outcomes for an input or a form question as well as providing background information. Keep in mind that Alert - Expandable should warrant an alert and be used sparingly. The value of any type of alert is diminished if the page is littered with alerts of equal weight.
4949
* **Showing an error.** Errors should never be hidden. They should only appear as a result of a user action, and always be visible to the user. The error text should be brief and clear, eliminating the need for it to be collapsed. Consider using a standard or slim variation of [Alert]({{ site.baseurl }}/components/alert) if there is an error.
5050

5151
### Behavior
@@ -89,6 +89,7 @@ The alert was tested as part of a usability study with 9 participants. The alert
8989
## Related
9090

9191
* [Additional info]({{ site.baseurl }}/components/additional-info)
92+
* [Details]({{ site.baseurl }}/components/details)
9293
* [Alert]({{ site.baseurl}}/components/alert)
9394

94-
{% include _component-checklist.html component_name=page.web-component %}
95+
{% include _component-checklist.html component_name=page.web-component %}

src/_components/alert/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Any style of alert box can be modified to be a Slim alert. The iconography for S
137137
##### Web and mobile
138138

139139
* **Unprompted and in-page alerts.** Consider the [Alert - Expandable]({{ site.baseurl }}/components/alert/alert-expandable) component to draw attention to important information on the page that is not a response to user feedback.
140-
* **Clarifying background information.** Use the [Additional info]({{ site.baseurl }}/components/additional-info) component when clarifying outcomes for an input or a form question as well as providing background information. Keep in mind that Alert - Expandable should warrant an alert and be used sparingly. The value of any type of alert is diminished if the page is littered with alerts of equal weight.
140+
* **Clarifying background information.** Use the [Details]({{ site.baseurl }}/components/details) component when clarifying outcomes for an input or a form question as well as providing background information. Keep in mind that Alert - Expandable should warrant an alert and be used sparingly. The value of any type of alert is diminished if the page is littered with alerts of equal weight.
141141
* **System maintenance on web.** Most [system messages]({{ site.baseurl }}/content-style-guide/error-messages/system) related to maintenance are handled by the [Banner - Maintenance]({{ site.baseurl }}/components/banner/maintenance) component.
142142
* **As the only content on a page.** An Alert should not be the only, or the majority of, content on a page. Reduce the length of the alert and include context in the content well of the page.
143143
* **For highlighting a single task that is urgent, time-sensitive, or required.** Consider the [Critical Action]({{ site.baseurl }}/components/critical-action) component when you want to highlight a single task that will otherwise block the user from proceeding. This can be used within [cards]({{ site.baseurl }}/components/card) or [service list items]({{ site.baseurl }}/components/service-list-item).
@@ -170,7 +170,7 @@ When the user is required to do something in response to an alert, let them know
170170
* Don't stack alerts one after the other.
171171
* When there are multiple alerts on the page, order them by severity with the most critical being first and ideally top of the page.
172172
* If the alert appears within the page body content, it should be co-located with relevant content.
173-
* Alerts should not contain other expandable components such as the [Additional info]({{ site.baseurl }}/components/) component.
173+
* Alerts should not contain other expandable components such as the [Details]({{ site.baseurl }}/components/details) component.
174174
* Messaging should be direct, concise, and in [plain language]({{ site.baseurl }}/content-style-guide/plain-language/).
175175
* Standard alerts must contain headings as opposed to Slim alerts which do not contain headings.
176176

src/_components/details.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
layout: component
3+
title: Details
4+
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."
6+
figma-link-web: https://www.figma.com/file/JDFpGLIojfuQwANXScQjqe/VADS-Component-Examples?type=design&node-id=1350%3A22760&mode=design&t=TiJHClaf3VQ6wU6B-1
7+
uswds-v3: default
8+
web-component: va-details
9+
web: true
10+
mobile-app: false
11+
uses_mermaid: true
12+
anchors:
13+
- anchor: Examples
14+
- anchor: Usage
15+
- anchor: Behavior
16+
- anchor: Code usage
17+
- anchor: Content considerations
18+
- anchor: Accessibility considerations
19+
- anchor: Related
20+
- anchor: Component checklist
21+
---
22+
23+
## Examples
24+
25+
### Default
26+
27+
{% include storybook-preview.html story="uswds-va-details--default" link_text="va-details default" %}
28+
29+
## Usage
30+
31+
### When to use Details
32+
33+
* **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.
34+
* **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.
35+
* **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.
36+
* **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+
* **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.
38+
* **Information not applicable to all**: Details can hide details that may not be applicable to all users.
39+
40+
### When to consider something else
41+
42+
* **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.
43+
* **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.
44+
* **Required content**: If the majority of people need the content to accomplish the main task then it should not be hidden from view.
45+
* **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).
46+
* **Error messages or other immediate actions**: Do not use this component for error messages or other critical or timely information.
47+
* **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.
48+
* **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.
49+
50+
{% include content/details-vs-hint-text-vs-accordion.md %}
51+
52+
## Behavior
53+
54+
The Details component uses native HTML `<details>` and `<summary>` elements, which provide several advantages over JavaScript-based implementations:
55+
56+
* **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).
57+
* **Better performance and reliability**: No JavaScript required for basic functionality, improving load times and ensuring content works even when JavaScript fails.
58+
* **Enhanced accessibility**: Native semantic meaning provides better assistive technology support without additional ARIA attributes, following web standards universally supported across browsers.
59+
60+
### Placement
61+
62+
The following are places where Details can be used:
63+
64+
* After a header (h2, h3, h4) or paragraph to provide orthogonal details or provide an answer to a common question.
65+
* Within a [Process list]({{ site.baseurl }}/components/process-list) to shorten the length of content within a step.
66+
* Within, or at the end, of a [Form]({{ site.baseurl }}/components/form/label#with-details) to provide additional help text.
67+
* Whenever there is a chance to enhance the understanding a user has about a particular choice.
68+
69+
**Note:** Placement does not alter [content considerations](#content-considerations) in any way.
70+
71+
{% include component-docs.html component_name=page.web-component %}
72+
73+
## Content considerations
74+
75+
* **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.
76+
* **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.
77+
* **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.
78+
79+
## Accessibility considerations
80+
81+
* **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.
82+
* **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.
83+
* **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.
84+
85+
## Related
86+
87+
* [Accordion]({{ site.baseurl }}/components/accordion)
88+
* [Alert]({{ site.baseurl }}/components/alert)
89+
90+
{% include _component-checklist.html component_name=page.web-component %}

src/_components/form/text-input.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Also refer to the overall [form guidance]({{ site.baseurl }}/components/form#hin
5050

5151
{% include storybook-preview.html story="uswds-va-text-input--with-inline-hint-text" link_text="va-text-input with inline Hint text" height="155px" auto_resize=false %}
5252

53-
### Additional Info
53+
### Details
5454

55-
{% include storybook-preview.html story="uswds-va-text-input--with-additional-info" link_text="va-text-input with Additional info" %}
55+
{% include storybook-preview.html story="uswds-va-text-input--with-details" link_text="va-text-input with Details" %}
5656

5757
### Character count
5858

@@ -126,7 +126,7 @@ See [form error handling]({{ site.baseurl }}/components/form/#error-handling) fo
126126
* **Autocomplete.** Specifies what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.
127127
* **Hint Text.** Provides a short hint to the user on what to enter into the field.
128128
* **Inline Hint Text.** Provides a very short hint to the user within the label on what to enter into the field. Hint text is preferred to inline hint text.
129-
* **Additional Info.** Depicts how to use the [additional info component]({{ site.baseurl }}/components/additional-info) within a va-text-input.
129+
* **Details.** Depicts how to use the [Details component]({{ site.baseurl }}/components/details) within a va-text-input.
130130
* **Character count.** Implements the [USWDS Character count](https://designsystem.digital.gov/components/character-count/) functionality which displays the character count below the text input. However, our implementation differs from USWDS in that it does not allow for entering more text after the maxlength.
131131
* **Currency.** Indicates that the input accepts a dollar amount.
132132
* **Forms pattern - Single.** This variation can be used to support the [One thing per page content principle]({{ site.baseurl }}/patterns/help-users-to/complete-a-sub-task#design-principles) where we gather one decision, question, or piece of information on the page.

0 commit comments

Comments
 (0)