@ukhomeoffice/cop-react-form-renderer 6.15.12 → 6.15.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -129,6 +129,17 @@ const InternalFormRenderer = _ref2 => {
|
|
|
129
129
|
validate
|
|
130
130
|
} = (0, _hooks.useValidation)();
|
|
131
131
|
|
|
132
|
+
// Set focus to header for accessibility, Screen reader to anounce the page heading
|
|
133
|
+
const setFocusToHeading = () => {
|
|
134
|
+
if (document) {
|
|
135
|
+
const header = Array.from(document.getElementsByTagName('h1')).pop();
|
|
136
|
+
if (header && document.activeElement !== header) {
|
|
137
|
+
header.setAttribute('tabIndex', '-1');
|
|
138
|
+
header.focus();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
132
143
|
// Need to set submission data when going back
|
|
133
144
|
window.onpopstate = e => {
|
|
134
145
|
var _formState$page;
|
|
@@ -192,6 +203,11 @@ const InternalFormRenderer = _ref2 => {
|
|
|
192
203
|
setHub(_utils.default.Hub.get(type, _hub, components, _objectSpread({}, data)));
|
|
193
204
|
}, [type, _hub, data, components, setHub]);
|
|
194
205
|
|
|
206
|
+
// Set focus to heading for accessibility
|
|
207
|
+
(0, _react.useEffect)(() => {
|
|
208
|
+
setFocusToHeading();
|
|
209
|
+
}, [formState]);
|
|
210
|
+
|
|
195
211
|
// Form state.
|
|
196
212
|
(0, _react.useEffect)(() => {
|
|
197
213
|
var _formState$page2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "6.15.
|
|
3
|
+
"version": "6.15.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"yalc-publish": "yarn compile-with-maps && cp -r src dist/src && yalc publish --push"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ukhomeoffice/cop-react-components": "4.7.
|
|
20
|
+
"@ukhomeoffice/cop-react-components": "4.7.17",
|
|
21
21
|
"axios": "^0.23.0",
|
|
22
22
|
"dayjs": "^1.11.0",
|
|
23
23
|
"govuk-frontend": "^5.0.0",
|