Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# @formio/uswds

## 2.9.1

### Patch Changes

- 793d0d8: FIO-11291: fixed Field Set Legend announcement by a screen reader for all Components within the field set on the View Submission page and PDF download
- 3c302ee: FIO-12013 Fixed excessive label announcements in NVDA
- Updated dependencies [8eb6855]
- Updated dependencies [1d9fcee]
- Updated dependencies [5d51d06]
- Updated dependencies [6298b64]
- Updated dependencies [3f8bcc1]
- Updated dependencies [793d0d8]
- Updated dependencies [2a0676a]
- Updated dependencies [543b082]
- Updated dependencies [5fa2592]
- Updated dependencies [587b8b4]
- Updated dependencies [dc60a11]
- Updated dependencies [b20c6e2]
- Updated dependencies [5ec8478]
- Updated dependencies [eccfae0]
- @formio/js@5.5.1

## 2.9.1-api99.1

### Patch Changes

- Updated dependencies [587b8b4]
- @formio/js@5.5.1-api99.1

## 2.9.1-api99.0

### Patch Changes

- 793d0d8: FIO-11291: fixed Field Set Legend announcement by a screen reader for all Components within the field set on the View Submission page and PDF download
- 3c302ee: FIO-12013 Fixed excessive label announcements in NVDA
- Updated dependencies [8eb6855]
- Updated dependencies [1d9fcee]
- Updated dependencies [5d51d06]
- Updated dependencies [6298b64]
- Updated dependencies [3f8bcc1]
- Updated dependencies [793d0d8]
- Updated dependencies [82583ef]
- Updated dependencies [2a0676a]
- Updated dependencies [543b082]
- Updated dependencies [5fa2592]
- Updated dependencies [dc60a11]
- Updated dependencies [b20c6e2]
- Updated dependencies [5ec8478]
- Updated dependencies [eccfae0]
- @formio/js@5.5.1-api99.0

## 2.9.0

### Minor Changes
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formio/uswds",
"version": "2.9.0",
"version": "2.9.1",
"description": "US Web Design System templates for form.io",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -34,10 +34,10 @@
"Standards"
],
"peerDependencies": {
"@formio/js": "^5.5.0"
"@formio/js": "^5.5.1"
},
"devDependencies": {
"@formio/js": "^5.5.0",
"@formio/js": "^5.5.1",
"@types/chai": "^4.2.22",
"@types/ejs": "^3.1.0",
"@types/mocha": "^9.0.0",
Expand Down
8 changes: 8 additions & 0 deletions src/templates/uswds/checkbox/form.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var ariaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var ariaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key); %}
<div
ref="messageContainer"
class="text-secondary-dark width-full margin-top-05 formio-errors"
Expand All @@ -12,6 +18,7 @@
{{attr}}="{{ctx.input.attr[attr]}}"
{% } %}
{% if (ctx.checked) { %}checked=true{% } %}
{{ariaAttr}}="{{ariaValue}}"
aria-required="{{ctx.component.validate.required}}"
{% if (ctx.component.description) { %}
aria-describedby="d-{{ctx.instance.id}}-{{ctx.component.key}}"
Expand All @@ -21,6 +28,7 @@
ref="label"
class="{{ctx.input.labelClass}} usa-checkbox__label"
for="{{ctx.id}}-{{ctx.input.attr.name}}"
id="l-{{ctx.instance.id}}-{{ctx.component.key}}"
>
{{ctx.input.label}}
{{ctx.input.content}}
Expand Down
8 changes: 7 additions & 1 deletion src/templates/uswds/day/form.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var dayAriaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var dayAriaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key); %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-sr-only">{{ctx.component.label}}</legend>
<div class="usa-memorable-date display-flex"
Expand All @@ -6,7 +12,7 @@
{% if (ctx.component.hideLabel) { %}
aria-label="{{ctx.component.label}}"
{% } else { %}
aria-labelledby="l-{{ctx.instance.id}}-{{ctx.component.key}}"
{{dayAriaAttr}}="{{dayAriaValue}}"
{% } %}
{% if (ctx.component.description) { %}
aria-describedby="d-{{ctx.instance.id}}-{{ctx.component.key}}"
Expand Down
8 changes: 7 additions & 1 deletion src/templates/uswds/input/form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@
</div>
{% } %}
{% if (!ctx.component.editor && !ctx.component.wysiwyg) { %}
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var ariaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var ariaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key + (ctx.component.description ? ' d-' + ctx.instance.id + '-' + ctx.component.key : '')); %}
<{{ctx.input.type}}
class="usa-{{ctx.input.type === 'textarea' ? 'textarea' : 'input'}} maxw-full"
ref="{{ctx.input.ref || 'input'}}"
{% for (var attr in ctx.input.attr) { %}
{{attr}}="{{ctx.input.attr[attr]}}"
{% } %}
id="{{ctx.instance.id}}-{{ctx.component.key}}"
aria-labelledby="l-{{ctx.instance.id}}-{{ctx.component.key}} {% if (ctx.component.description) { %}d-{{ctx.instance.id}}-{{ctx.component.key}}{% } %}"
{{ariaAttr}}="{{ariaValue}}"
aria-required="{{ctx.input.ref === 'input' || !ctx.input.ref ? ctx.component.validate.required : ctx.component.fields[ctx.input.ref].required}}"
>{{ctx.input.content}}</{{ctx.input.type}}>
{% } %}
Expand Down
3 changes: 3 additions & 0 deletions src/templates/uswds/label/form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
ref="label"
id="l-{{ctx.instance.id}}-{{ctx.component.key}}"
for="{{ctx.instance.id}}-{{ctx.component.key}}"
{% if (ctx.label.hidden) { %}
aria-hidden="true"
{% } %}
>
<span>{{ ctx.t(ctx.component.label) }}</span>
{% if (ctx.component.type === 'number' || ctx.component.type === 'phoneNumber' || ctx.component.type === 'currency') { %}
Expand Down
8 changes: 7 additions & 1 deletion src/templates/uswds/radio/form.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var ariaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var ariaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key + (ctx.component.description ? ' d-' + ctx.instance.id + '-' + ctx.component.key : '')); %}
<fieldset
class="usa-fieldset"
ref="radioGroup"
aria-labelledby="l-{{ctx.instance.id}}-{{ctx.component.key}} {% if (ctx.component.description) { %}d-{{ctx.instance.id}}-{{ctx.component.key}}{% } %}"
{{ariaAttr}}="{{ariaValue}}"
>
<legend id="l-{{ctx.instance.id}}-{{ctx.component.key}}" ref="label" class="usa-sr-only">
{{ctx.t(ctx.component.label)}}
Expand Down
8 changes: 7 additions & 1 deletion src/templates/uswds/select/form.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var ariaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var ariaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key); %}
<select
ref="{{ctx.input.ref ? ctx.input.ref : 'selectContainer'}}"
class="usa-select maxw-full {{ctx.disabled ? 'bg-base-lightest' : ''}}"
Expand All @@ -7,7 +13,7 @@
{% if (!ctx.input.attr.id) { %}
id="{{ctx.instance.id}}-{{ctx.component.key}}"
{% } %}
aria-labelledby="l-{{ctx.instance.id}}-{{ctx.component.key}}"
{{ariaAttr}}="{{ariaValue}}"
{% if (ctx.component.description) { %}
aria-describedby="d-{{ctx.instance.id}}-{{ctx.component.key}}"
{% } %}
Expand Down
10 changes: 9 additions & 1 deletion src/templates/uswds/survey/form.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<table class="usa-table">
{% var fieldsetLegendIds = ctx.instance.getFieldsetLegendIds ? ctx.instance.getFieldsetLegendIds() : ''; %}
{% var isViewReadContext = ctx.instance.options && (ctx.instance.options.readOnly || ctx.instance.options.pdf); %}
{% var viewAccessibleLabel = isViewReadContext && ctx.instance.getFormattedViewAccessibleLabel ? ctx.instance.getFormattedViewAccessibleLabel() : ''; %}
{% var useAriaLabelOnly = isViewReadContext && viewAccessibleLabel; %}
{% var ariaAttr = useAriaLabelOnly ? 'aria-label' : 'aria-labelledby'; %}
{% var ariaValue = useAriaLabelOnly ? viewAccessibleLabel : ((fieldsetLegendIds ? fieldsetLegendIds + ' ' : '') + 'l-' + ctx.instance.id + '-' + ctx.component.key); %}
<table class="usa-table"
{{ariaAttr}}="{{ariaValue}}"
>
<thead>
<tr>
<th scope="col"></th>
Expand Down
Loading