diff --git a/packages/terra-action-header/CHANGELOG.md b/packages/terra-action-header/CHANGELOG.md
index d532b20712b..9881c5609c6 100644
--- a/packages/terra-action-header/CHANGELOG.md
+++ b/packages/terra-action-header/CHANGELOG.md
@@ -2,6 +2,11 @@
## Unreleased
+* Added
+ * Added `text` prop as a replacement of `title` prop to avoid confusion with HTML attribute `title`.
+ * Added Ally labels for action header navigation buttons.
+ * Added translations for back, next and previous button.
+
* Changed
* Updated jest snapshots for button changes.
diff --git a/packages/terra-action-header/package.json b/packages/terra-action-header/package.json
index d36ced7a706..2bfa421419e 100644
--- a/packages/terra-action-header/package.json
+++ b/packages/terra-action-header/package.json
@@ -29,10 +29,12 @@
"dependencies": {
"@cerner/terra-docs": "^1.9.0",
"classnames": "^2.2.5",
+ "lodash.uniqueid": "^4.0.1",
"prop-types": "^15.5.8",
"terra-button": "^3.64.0",
"terra-mixins": "^1.40.0",
- "terra-theme-context": "^1.0.0"
+ "terra-theme-context": "^1.0.0",
+ "terra-visually-hidden-text": "2.36.0"
},
"scripts": {
"compile": "babel --root-mode upward src --out-dir lib --copy-files",
diff --git a/packages/terra-action-header/src/ActionHeader.jsx b/packages/terra-action-header/src/ActionHeader.jsx
index e8840973d26..5d4e83ddc30 100644
--- a/packages/terra-action-header/src/ActionHeader.jsx
+++ b/packages/terra-action-header/src/ActionHeader.jsx
@@ -4,6 +4,7 @@ import classNames from 'classnames/bind';
import Button, { ButtonVariants } from 'terra-button';
import { injectIntl } from 'react-intl';
import ThemeContext from 'terra-theme-context';
+import uniqueid from 'lodash.uniqueid';
import ActionHeaderContainer from './_ActionHeaderContainer';
import styles from './ActionHeader.module.scss';
@@ -20,8 +21,10 @@ const propTypes = {
*/
intl: PropTypes.shape({ formatMessage: PropTypes.func }),
/**
+ * 
* Optionally sets the heading level. One of `1`, `2`, `3`, `4`, `5`, `6`. Default `level=1`. This helps screen readers to announce appropriate heading levels.
* Changing 'level' will not visually change the style of the content.
+ * `level` should be specified explicitly to allow screen readers to identify headers consistently.
*/
level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
/**
@@ -33,6 +36,10 @@ const propTypes = {
* Callback function for when the back button is clicked. The back button will not display if this is not set.
*/
onBack: PropTypes.func,
+ /**
+ * Accessibility label for Back button. To be used with onBack prop.
+ */
+ backButtonA11yLabel: PropTypes.string,
/**
* Callback function for when the expand button is clicked.
* The expand button will not display if this is not set or on small viewports.
@@ -55,19 +62,32 @@ const propTypes = {
* Callback function for when the next button is clicked. The previous-next button group will display if either this or onPrevious is set but the button for the one not set will be disabled.
*/
onNext: PropTypes.func,
+ /**
+ * Accessibility label for Next button. To be used with onNext prop
+ */
+ nextButtonA11yLabel: PropTypes.string,
/**
* Callback function for when the previous button is clicked. The previous-next button group will display if either this or onNext is set but the button for the one not set will be disabled.
*/
onPrevious: PropTypes.func,
/**
+ * Accessibility label for Previous button. To be used with onPrevious prop.
+ */
+ prevButtonA11yLabel: PropTypes.string,
+ /**
+ * 
* Text to be displayed as the title in the header bar.
*/
+ text: PropTypes.string,
+ /**
+ * 
+ * title prop has been deperecated and will be removed on next major version relase. Replace the `title` prop with `text` prop.
+ */
title: PropTypes.string,
};
const defaultProps = {
- title: undefined,
- level: 1,
+ text: undefined,
onClose: undefined,
onBack: undefined,
onMaximize: undefined,
@@ -75,9 +95,13 @@ const defaultProps = {
onNext: undefined,
onPrevious: undefined,
children: undefined,
+ backButtonA11yLabel: undefined,
+ prevButtonA11yLabel: undefined,
+ nextButtonA11yLabel: undefined,
};
const ActionHeader = ({
+ text,
title,
intl,
level,
@@ -88,9 +112,16 @@ const ActionHeader = ({
onPrevious,
onNext,
children,
+ backButtonA11yLabel,
+ prevButtonA11yLabel,
+ nextButtonA11yLabel,
...customProps
}) => {
const theme = React.useContext(ThemeContext);
+ const buttonId = uniqueid();
+ const closeButtonId = `terra-action-header-close-button-${buttonId}`;
+ const maximizeButtonId = `terra-action-header-maximize-button-${buttonId}`;
+ const minimizeButtonId = `terra-action-header-minimize-button-${buttonId}`;
const closeButton = onClose
? (
@@ -102,6 +133,7 @@ const ActionHeader = ({
text={intl.formatMessage({ id: 'Terra.actionHeader.close' })}
onClick={onClose}
variant={ButtonVariants.UTILITY}
+ aria-describedby={closeButtonId}
/>
)
: null;
@@ -112,7 +144,7 @@ const ActionHeader = ({
data-terra-action-header="back-button"
isIconOnly
icon={}
- text={intl.formatMessage({ id: 'Terra.actionHeader.back' })}
+ text={backButtonA11yLabel || intl.formatMessage({ id: 'Terra.actionHeader.back' })}
onClick={onBack}
variant={ButtonVariants.UTILITY}
/>
@@ -131,6 +163,7 @@ const ActionHeader = ({
text={intl.formatMessage({ id: 'Terra.actionHeader.maximize' })}
onClick={onMaximize}
variant={ButtonVariants.UTILITY}
+ aria-describedby={maximizeButtonId}
/>
);
} else if (onMinimize) {
@@ -143,6 +176,7 @@ const ActionHeader = ({
text={intl.formatMessage({ id: 'Terra.actionHeader.minimize' })}
onClick={onMinimize}
variant={ButtonVariants.UTILITY}
+ aria-describedby={minimizeButtonId}
/>
);
}
@@ -156,7 +190,7 @@ const ActionHeader = ({
data-terra-action-header="previous-button"
isIconOnly
icon={}
- text={intl.formatMessage({ id: 'Terra.actionHeader.previous' })}
+ text={prevButtonA11yLabel || intl.formatMessage({ id: 'Terra.actionHeader.previous' })}
onClick={onPrevious}
isDisabled={onPrevious === undefined}
variant={ButtonVariants.UTILITY}
@@ -166,7 +200,7 @@ const ActionHeader = ({
data-terra-action-header="next-button"
isIconOnly
icon={}
- text={intl.formatMessage({ id: 'Terra.actionHeader.next' })}
+ text={nextButtonA11yLabel || intl.formatMessage({ id: 'Terra.actionHeader.next' })}
onClick={onNext}
isDisabled={onNext === undefined}
variant={ButtonVariants.UTILITY}
@@ -186,14 +220,22 @@ const ActionHeader = ({
: null;
const rightButtons = closeButton ?
{closeButton}
: null;
-
+ if (title) {
+ // eslint-disable-next-line no-console
+ console.warn('`title` prop has been renamed to `text`. please update all the refernces of `title` prop to use prop `text`.'); // to be removed on next major version release.
+ }
+ if (!level) {
+ // eslint-disable-next-line no-console
+ console.warn('Default heading level may not appropriate has it would fail to convey context of heading in a site / application where it is used. Heading level should be set explicitly depending on the position of header in site / application to allow screen readers to identify headers consistently.'); // to be removed on next major version release.
+ }
return (
{children}
diff --git a/packages/terra-action-header/src/ActionHeaderContainer.module.scss b/packages/terra-action-header/src/ActionHeaderContainer.module.scss
index 700b6e15b1a..bc5e3dbe4d0 100644
--- a/packages/terra-action-header/src/ActionHeaderContainer.module.scss
+++ b/packages/terra-action-header/src/ActionHeaderContainer.module.scss
@@ -70,4 +70,8 @@
}
}
/* stylelint-enable selector-max-compound-selectors */
+
+ .hidden-label {
+ height: 0;
+ }
}
diff --git a/packages/terra-action-header/src/_ActionHeaderContainer.jsx b/packages/terra-action-header/src/_ActionHeaderContainer.jsx
index 578a005a3a7..6761e24bcc8 100644
--- a/packages/terra-action-header/src/_ActionHeaderContainer.jsx
+++ b/packages/terra-action-header/src/_ActionHeaderContainer.jsx
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import classNamesBind from 'classnames/bind';
import ThemeContext from 'terra-theme-context';
+import VisuallyHiddenText from 'terra-visually-hidden-text';
+import { injectIntl } from 'react-intl';
import styles from './ActionHeaderContainer.module.scss';
const cx = classNamesBind.bind(styles);
@@ -22,7 +24,7 @@ const propTypes = {
/**
* Text to be displayed as the title in the header bar.
*/
- title: PropTypes.string,
+ text: PropTypes.string,
/**
* Content to be displayed at the end of the header.
@@ -34,16 +36,21 @@ const propTypes = {
* Changing 'level' will not visually change the style of the content.
*/
level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]).isRequired,
+ /**
+ * @private
+ * The intl object to be injected for translations.
+ */
+ intl: PropTypes.shape({ formatMessage: PropTypes.func }),
};
const defaultProps = {
- title: undefined,
+ text: undefined,
startContent: undefined,
endContent: undefined,
};
const ActionHeaderContainer = ({
- children, title, startContent, endContent, level, ...customProps
+ children, text, startContent, endContent, level, intl, ...customProps
}) => {
const theme = React.useContext(ThemeContext);
const HeaderElement = `h${level}`;
@@ -52,10 +59,22 @@ const ActionHeaderContainer = ({
React.cloneElement(child, { className: cx(['flex-collapse', children.props.className]) })
));
- const titleElement = title ? (
+ const closeButtonId = `terra-action-header-close-button-${customProps.id}`;
+ const maximizeButtonId = `terra-action-header-maximize-button-${customProps.id}`;
+ const minimizeButtonId = `terra-action-header-minimize-button-${customProps.id}`;
+
+ const visuallyHiddenComponent = (
+ <>
+
+
+
+ >
+ );
+
+ const titleElement = text ? (
-
+ }
+ text="Action Header"
+/>
`;
exports[`ActionHeader should render a default action header 1`] = `
-
`;
exports[`ActionHeader should render an action header with back and close buttons and title 1`] = `
-
}
+ id="5"
level={1}
startContent={
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with back button and title 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with close button and title 1`] = `
-
}
+ id="4"
level={1}
startContent={null}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with custom button and title 1`] = `
-
-
+
`;
exports[`ActionHeader should render an action header with level three header element and title 1`] = `
-
`;
exports[`ActionHeader should render an action header with maximize button and title 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with minimize button and title 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with multiple custom buttons and title 1`] = `
-
-
+
`;
exports[`ActionHeader should render an action header with next and previous buttons and title 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with title 1`] = `
-
`;
exports[`ActionHeader should render an action header with title, enabled next button, and disabled previous button 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
exports[`ActionHeader should render an action header with title, enabled previous button, and disabled next button 1`] = `
-
}
- title="Action Header"
+ text="Action Header"
/>
`;
diff --git a/packages/terra-action-header/translations/de.json b/packages/terra-action-header/translations/de.json
index f02852cd59c..8dbf430ee86 100644
--- a/packages/terra-action-header/translations/de.json
+++ b/packages/terra-action-header/translations/de.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Vorherige",
"Terra.actionHeader.next": "Nächste",
"Terra.actionHeader.maximize": "Maximieren",
- "Terra.actionHeader.minimize": "Minimieren"
+ "Terra.actionHeader.minimize": "Minimieren",
+ "Terra.actionHeader.close.description": "Klicken Sie auf 'Schließen', um {text} zu schließen.",
+ "Terra.actionHeader.maximize.description": "Klicken Sie auf 'Maximieren', um {text} zu maximieren.",
+ "Terra.actionHeader.minimize.description": "Klicken Sie auf 'Minimieren', um {text} zu minimieren."
}
diff --git a/packages/terra-action-header/translations/en-AU.json b/packages/terra-action-header/translations/en-AU.json
index e5b26161abe..da208875435 100644
--- a/packages/terra-action-header/translations/en-AU.json
+++ b/packages/terra-action-header/translations/en-AU.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Previous",
"Terra.actionHeader.next": "Next",
"Terra.actionHeader.maximize": "Maximize",
- "Terra.actionHeader.minimize": "Minimize"
+ "Terra.actionHeader.minimize": "Minimize",
+ "Terra.actionHeader.close.description": "On Clicking the close button, {text} will be closed",
+ "Terra.actionHeader.maximize.description": "On Clicking the maximize button, {text} will be maximized",
+ "Terra.actionHeader.minimize.description": "On Clicking the minimize button, {text} will be minimized"
}
diff --git a/packages/terra-action-header/translations/en-CA.json b/packages/terra-action-header/translations/en-CA.json
index e5b26161abe..da208875435 100644
--- a/packages/terra-action-header/translations/en-CA.json
+++ b/packages/terra-action-header/translations/en-CA.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Previous",
"Terra.actionHeader.next": "Next",
"Terra.actionHeader.maximize": "Maximize",
- "Terra.actionHeader.minimize": "Minimize"
+ "Terra.actionHeader.minimize": "Minimize",
+ "Terra.actionHeader.close.description": "On Clicking the close button, {text} will be closed",
+ "Terra.actionHeader.maximize.description": "On Clicking the maximize button, {text} will be maximized",
+ "Terra.actionHeader.minimize.description": "On Clicking the minimize button, {text} will be minimized"
}
diff --git a/packages/terra-action-header/translations/en-GB.json b/packages/terra-action-header/translations/en-GB.json
index 788b8f776a1..da22ff8523d 100644
--- a/packages/terra-action-header/translations/en-GB.json
+++ b/packages/terra-action-header/translations/en-GB.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Previous",
"Terra.actionHeader.next": "Next",
"Terra.actionHeader.maximize": "Maximise",
- "Terra.actionHeader.minimize": "Minimise"
+ "Terra.actionHeader.minimize": "Minimise",
+ "Terra.actionHeader.close.description": "On Clicking the close button, {text} will be closed",
+ "Terra.actionHeader.maximize.description": "On Clicking the maximize button, {text} will be maximized",
+ "Terra.actionHeader.minimize.description": "On Clicking the minimize button, {text} will be minimized"
}
diff --git a/packages/terra-action-header/translations/en-US.json b/packages/terra-action-header/translations/en-US.json
index e5b26161abe..da208875435 100644
--- a/packages/terra-action-header/translations/en-US.json
+++ b/packages/terra-action-header/translations/en-US.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Previous",
"Terra.actionHeader.next": "Next",
"Terra.actionHeader.maximize": "Maximize",
- "Terra.actionHeader.minimize": "Minimize"
+ "Terra.actionHeader.minimize": "Minimize",
+ "Terra.actionHeader.close.description": "On Clicking the close button, {text} will be closed",
+ "Terra.actionHeader.maximize.description": "On Clicking the maximize button, {text} will be maximized",
+ "Terra.actionHeader.minimize.description": "On Clicking the minimize button, {text} will be minimized"
}
diff --git a/packages/terra-action-header/translations/en.json b/packages/terra-action-header/translations/en.json
index e5b26161abe..da208875435 100644
--- a/packages/terra-action-header/translations/en.json
+++ b/packages/terra-action-header/translations/en.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Previous",
"Terra.actionHeader.next": "Next",
"Terra.actionHeader.maximize": "Maximize",
- "Terra.actionHeader.minimize": "Minimize"
+ "Terra.actionHeader.minimize": "Minimize",
+ "Terra.actionHeader.close.description": "On Clicking the close button, {text} will be closed",
+ "Terra.actionHeader.maximize.description": "On Clicking the maximize button, {text} will be maximized",
+ "Terra.actionHeader.minimize.description": "On Clicking the minimize button, {text} will be minimized"
}
diff --git a/packages/terra-action-header/translations/es-ES.json b/packages/terra-action-header/translations/es-ES.json
index ac897fa524e..1403ccc739b 100644
--- a/packages/terra-action-header/translations/es-ES.json
+++ b/packages/terra-action-header/translations/es-ES.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Anterior",
"Terra.actionHeader.next": "Siguiente",
"Terra.actionHeader.maximize": "Maximizar",
- "Terra.actionHeader.minimize": "Minimimzar"
+ "Terra.actionHeader.minimize": "Minimimzar",
+ "Terra.actionHeader.close.description": "Seleccione el botón para cerrar {text}",
+ "Terra.actionHeader.maximize.description": "Seleccione el botón para maximizar {text}",
+ "Terra.actionHeader.minimize.description": "Seleccione el botón para minimizar {text}"
}
diff --git a/packages/terra-action-header/translations/es-US.json b/packages/terra-action-header/translations/es-US.json
index ac897fa524e..1403ccc739b 100644
--- a/packages/terra-action-header/translations/es-US.json
+++ b/packages/terra-action-header/translations/es-US.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Anterior",
"Terra.actionHeader.next": "Siguiente",
"Terra.actionHeader.maximize": "Maximizar",
- "Terra.actionHeader.minimize": "Minimimzar"
+ "Terra.actionHeader.minimize": "Minimimzar",
+ "Terra.actionHeader.close.description": "Seleccione el botón para cerrar {text}",
+ "Terra.actionHeader.maximize.description": "Seleccione el botón para maximizar {text}",
+ "Terra.actionHeader.minimize.description": "Seleccione el botón para minimizar {text}"
}
diff --git a/packages/terra-action-header/translations/es.json b/packages/terra-action-header/translations/es.json
index de04eb8d235..7179796013f 100644
--- a/packages/terra-action-header/translations/es.json
+++ b/packages/terra-action-header/translations/es.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Anterior",
"Terra.actionHeader.next": "Siguiente",
"Terra.actionHeader.maximize": "Maximizar",
- "Terra.actionHeader.minimize": "Minimizar"
+ "Terra.actionHeader.minimize": "Minimizar",
+ "Terra.actionHeader.close.description": "Seleccione el botón para cerrar {text}",
+ "Terra.actionHeader.maximize.description": "Seleccione el botón para maximizar {text}",
+ "Terra.actionHeader.minimize.description": "Seleccione el botón para minimizar {text}"
}
diff --git a/packages/terra-action-header/translations/fi-FI.json b/packages/terra-action-header/translations/fi-FI.json
index 1966ba6141f..2e09729b7b6 100644
--- a/packages/terra-action-header/translations/fi-FI.json
+++ b/packages/terra-action-header/translations/fi-FI.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Edellinen",
"Terra.actionHeader.next": "Seuraava",
"Terra.actionHeader.maximize": "Maksimoida",
- "Terra.actionHeader.minimize": "Minimoida"
+ "Terra.actionHeader.minimize": "Minimoida",
+ "Terra.actionHeader.close.description": "Valitse painike sulkeaksesi {text}",
+ "Terra.actionHeader.maximize.description": "Valitse painike suurentaaksesi {text}",
+ "Terra.actionHeader.minimize.description": "Valitse painike pienentääksesi {text}"
}
diff --git a/packages/terra-action-header/translations/fr-FR.json b/packages/terra-action-header/translations/fr-FR.json
index 5f63a5fe8a1..e479b5f4e9e 100644
--- a/packages/terra-action-header/translations/fr-FR.json
+++ b/packages/terra-action-header/translations/fr-FR.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Précédent",
"Terra.actionHeader.next": "Suivant",
"Terra.actionHeader.maximize": "Agrandir",
- "Terra.actionHeader.minimize": "Réduire"
+ "Terra.actionHeader.minimize": "Réduire",
+ "Terra.actionHeader.close.description": "Sélectionnez le bouton pour fermer {text}.",
+ "Terra.actionHeader.maximize.description": "Sélectionnez le bouton pour agrandir {text}.",
+ "Terra.actionHeader.minimize.description": "Sélectionnez le bouton pour réduire {text}."
}
diff --git a/packages/terra-action-header/translations/fr.json b/packages/terra-action-header/translations/fr.json
index b9562b8a421..a2f13e8d6c1 100644
--- a/packages/terra-action-header/translations/fr.json
+++ b/packages/terra-action-header/translations/fr.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Précédent",
"Terra.actionHeader.next": "Suivant",
"Terra.actionHeader.maximize": "Agrandir",
- "Terra.actionHeader.minimize": "Réduire"
+ "Terra.actionHeader.minimize": "Réduire",
+ "Terra.actionHeader.close.description": "Sélectionnez le bouton pour fermer {text}.",
+ "Terra.actionHeader.maximize.description": "Sélectionnez le bouton pour agrandir {text}.",
+ "Terra.actionHeader.minimize.description": "Sélectionnez le bouton pour réduire {text}."
}
diff --git a/packages/terra-action-header/translations/nl-BE.json b/packages/terra-action-header/translations/nl-BE.json
index aae1d3bcd7c..f5fa44dec3a 100644
--- a/packages/terra-action-header/translations/nl-BE.json
+++ b/packages/terra-action-header/translations/nl-BE.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.maximize": "Maximalisatie",
"Terra.actionHeader.minimize": "Minimaliseren",
"Terra.actionHeader.next": "Volgende",
- "Terra.actionHeader.previous": "Vorige"
+ "Terra.actionHeader.previous": "Vorige",
+ "Terra.actionHeader.close.description": "Selecteer de knop om {text} te sluiten",
+ "Terra.actionHeader.maximize.description": "Selecteer de knop om {text} te maximaliseren",
+ "Terra.actionHeader.minimize.description": "Selecteer de knop om {text} te minimaliseren"
}
diff --git a/packages/terra-action-header/translations/nl.json b/packages/terra-action-header/translations/nl.json
index aae1d3bcd7c..f5fa44dec3a 100644
--- a/packages/terra-action-header/translations/nl.json
+++ b/packages/terra-action-header/translations/nl.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.maximize": "Maximalisatie",
"Terra.actionHeader.minimize": "Minimaliseren",
"Terra.actionHeader.next": "Volgende",
- "Terra.actionHeader.previous": "Vorige"
+ "Terra.actionHeader.previous": "Vorige",
+ "Terra.actionHeader.close.description": "Selecteer de knop om {text} te sluiten",
+ "Terra.actionHeader.maximize.description": "Selecteer de knop om {text} te maximaliseren",
+ "Terra.actionHeader.minimize.description": "Selecteer de knop om {text} te minimaliseren"
}
diff --git a/packages/terra-action-header/translations/pt-BR.json b/packages/terra-action-header/translations/pt-BR.json
index 8c147c2150b..1265443eec4 100644
--- a/packages/terra-action-header/translations/pt-BR.json
+++ b/packages/terra-action-header/translations/pt-BR.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Anterior",
"Terra.actionHeader.next": "Avançar",
"Terra.actionHeader.maximize": "Maximizar",
- "Terra.actionHeader.minimize": "Minimizar"
+ "Terra.actionHeader.minimize": "Minimizar",
+ "Terra.actionHeader.close.description": "Selecione o botão para fechar {text}",
+ "Terra.actionHeader.maximize.description": "Selecione o botão para maximizar {text}",
+ "Terra.actionHeader.minimize.description": "Selecione o botão para minimizar {text}"
}
diff --git a/packages/terra-action-header/translations/pt.json b/packages/terra-action-header/translations/pt.json
index 35b962d02c2..3fecb9ad105 100644
--- a/packages/terra-action-header/translations/pt.json
+++ b/packages/terra-action-header/translations/pt.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.previous": "Anterior",
"Terra.actionHeader.next": "Próximo",
"Terra.actionHeader.maximize": "Maximizar",
- "Terra.actionHeader.minimize": "Minimizar"
+ "Terra.actionHeader.minimize": "Minimizar",
+ "Terra.actionHeader.close.description": "Selecione o botão para fechar {text}",
+ "Terra.actionHeader.maximize.description": "Selecione o botão para maximizar {text}",
+ "Terra.actionHeader.minimize.description": "Selecione o botão para minimizar {text}"
}
diff --git a/packages/terra-action-header/translations/sv-SE.json b/packages/terra-action-header/translations/sv-SE.json
index fcb8e0bc9f7..12d8c724886 100644
--- a/packages/terra-action-header/translations/sv-SE.json
+++ b/packages/terra-action-header/translations/sv-SE.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.maximize": "Maximera",
"Terra.actionHeader.minimize": "Minimera",
"Terra.actionHeader.next": "Nästa",
- "Terra.actionHeader.previous": "Föregående"
+ "Terra.actionHeader.previous": "Föregående",
+ "Terra.actionHeader.close.description": "Välj knappen för att stänga {text}",
+ "Terra.actionHeader.maximize.description": "Välj knappen för att maximera {text}",
+ "Terra.actionHeader.minimize.description": "Välj knappen för att minimera {text}"
}
\ No newline at end of file
diff --git a/packages/terra-action-header/translations/sv.json b/packages/terra-action-header/translations/sv.json
index fcb8e0bc9f7..12d8c724886 100644
--- a/packages/terra-action-header/translations/sv.json
+++ b/packages/terra-action-header/translations/sv.json
@@ -4,5 +4,8 @@
"Terra.actionHeader.maximize": "Maximera",
"Terra.actionHeader.minimize": "Minimera",
"Terra.actionHeader.next": "Nästa",
- "Terra.actionHeader.previous": "Föregående"
+ "Terra.actionHeader.previous": "Föregående",
+ "Terra.actionHeader.close.description": "Välj knappen för att stänga {text}",
+ "Terra.actionHeader.maximize.description": "Välj knappen för att maximera {text}",
+ "Terra.actionHeader.minimize.description": "Välj knappen för att minimera {text}"
}
\ No newline at end of file
diff --git a/packages/terra-core-docs/CHANGELOG.md b/packages/terra-core-docs/CHANGELOG.md
index 4d2ae846469..c341ae8c1d1 100644
--- a/packages/terra-core-docs/CHANGELOG.md
+++ b/packages/terra-core-docs/CHANGELOG.md
@@ -3,6 +3,7 @@
## Unreleased
* Changed
+ * Updated action-header examples to include A11y labels.
* Updated `terra-button-group` tests and examples.
* Added
diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/action-header/AccessibilityGuide.2.doc.mdx b/packages/terra-core-docs/src/terra-dev-site/doc/action-header/AccessibilityGuide.2.doc.mdx
new file mode 100644
index 00000000000..e6eefcd1850
--- /dev/null
+++ b/packages/terra-core-docs/src/terra-dev-site/doc/action-header/AccessibilityGuide.2.doc.mdx
@@ -0,0 +1,263 @@
+import { Badge } from 'terra-action-header/package.json?dev-site-package';
+import { Notice } from '@cerner/terra-docs';
+import Whitespace from "../../common/layout-helpers/Whitespace";
+import ActionHeaderWithDecorativeIcon from "./example/ActionHeaderWithDecorativeIcon";
+import ActionHeaderWithInformativeIcon from "./example/ActionHeaderWithInformativeIcon";
+import WebAIMSemanticHeadingContentStructure from './references/WebAIMSemanticHeadingContentStructure';
+import ActionHeaderNonUniqueIcon from './example/ActionHeaderNonUniqueIcon';
+
+
+
+
+
+# Accessibility Guide for Terra Action Header
+
+
+## Why is this important?
+
+> Terra Action Header is an essential component used to identify a section of content and provide controls to manage the respective content. If Terra Action Header lacks accessibility, it can prevent users from understanding content and necessary context to interact with the page.
+>
+> Action Headers provide a visual and programmatic presentation of content structure to convey a meaningful purpose to the section. Icon-only buttons are commonly use to visually communicate an action. Therefore, the buttons must be intuitive and have a programmatic association with other words on the page to ensure a unique and descriptive accessible control name.This will allow speech input devices to utilize them. Screen reader users will also rely on the added programmatic context to understand what precisely a control may do.
+
+
+
+## Accessibility Considerations:
+
+### Code Considerations
+>Headings and their various sub-levels ensure all users can understand the structure of the page by separating page content visually and programmatically to organize it in a meaningful way. Previous patterns combined size and styling details to create visual headings of the page without the appropriate programmatic context to properly convey the page’s structure. Missing or inappropriately ordered heading levels combined with the visual styling often resulted in accessibility barriers to people using assistive technologies.
+>
+>
+> For proper accessibility to assistive technologies, developers must ensure that all headings on the page follow these two imperatives:
+- Terra Action Headers **must always** follow the correct **heading level order** and **arrangement** for where it is placed within other content on the page.
+- Terra Action Headers may sometimes be used to **label page regions** and should have the appropriate landmark role to ensure the programmatic context.
+
+#### Heading Level Order and Arrangement _(always)_
+The primary objective of using Action Headers is to provide information on the structural hierarchy of a document. Therefore, headings must look like a heading and be programmatically coded to ensure users can understand the page structure. Additionally, the programmatic heading context can help some users navigate the page using assistive technologies like screen readers. The following are accessibility best practices that developers must follow to create accessible headers:
+- Developers must use the appropriate heading levels (1 to 6) by always providing a value to the '**level**' prop. The heading level should match the hierarchical structure of the page.
+- If a value to the '**level**' prop is not provided, the heading '**text**' will not be rendered.
+- For accessibility best practices, it is recommended that consumers should always use **only one** `
` per page or view. The one `
` should be the page title.
+- Nest headings by their level. Headings with an equal or higher level start a new section, headings with a lower level start new subsections that are part of the higher ranked section.
+- Avoid skipping heading levels to be more specific (for example, do not skip from `
to
`). However, it is permissible to skip headings in the other direction if it indicates closing a subsection (for example, from `
` |
+
+
+
+Headings create an outline for the content on the page, similar to a term paper outline or table of contents. The `
` describes the page as a whole (and should be similar to the page ``). A page should typically have only one `
`. Headings `
`through `
` represent increasing degrees of "indentation" in our conceptual "outline". As such, it does not make sense to skip heading levels, such as from `
` to `
`, going down the page. Here is an example of content hierarchy with corresponding heading levels: [[2]](/components/cerner-terra-core-docs/action-header/accessibility-guide#linked-references)
+>
+
+#### Labeling Page Regions _(as needed)_
+Action Header can also be used to provide labels to distinguish multiple page regions of the same type. Most content on web pages should be organized into sections. When pages are organized into sections, a heading should be present. Developers may choose to use sectioning elements to indicate these sections. When using a sectioning element, a clinical header should generally be the first content within the section to act as a label. The objective of this technique is to use section headings to convey the structure of the content. Action Headers can be used to:
+- Indicate start of main content
+- Mark up section headings within the main content area
+- Demarcate different navigational sections like top or main navigation, left or secondary navigation and footer navigation
+- Allow users the ability to navigate a page by sections or skip repeated blocks of
+
+#### Accessibility Guidance: Label Page Regions
+
+Sectioning content can be labeled using a combination of the [aria-labelledby](https://www.w3.org/WAI/tutorials/page-structure/labels/#using-aria-labelledby) property and id attribute, with the label concisely describing the purpose of the section. This technique is useful for situations where there is more than one sectioning element on the same page.
+
+
+
+
+
+#### Actionable elements within Action Header
+- Engineers must ensure the code order reflects the user’s logical reading order so actionable elements will receive focus in the expected order.
+- All actionable elements must be able to receive keyboard focus. Though a TABINDEX attribute should not be required to ensure keyboard use, if used, never use a TABINDEX higher than 0.
+- Terra provides the ability to use the up action to initiate actions. Do not initiate actions on the down event to ensure users can cancel their actions by moving off the interactable element.
+- Do not initiate any change of context or anything unexpected on focus or input of actionable elements.
+- Never override the visible keyboard focus state. Keyboard-only users rely on the focus state to see where they are on the page.
+- All actionable elements within Action Header must have an accessible name:
+ - Ensure the programmatic name of actionable elements matches the visual label of the element. Often, they are the same, but when an aria-label is used to create an accessible name, the aria-label value should be the same or similar to the visible name to ensure all users can access and activate it.
+ - For example, a button with an aria-label of “Submit” and the text label of “Send” would be problematic and create accessibility barriers for speech input device users.
+ - For buttons that use icons to convey meaning, it is critical to include alternate content to represent the icon's meaning.
+
+
+
+```jsx
+import ActionHeader from 'terra-action-header';
+import ContentContainer from 'terra-content-container';
+import IconPrinter from 'terra-icon/lib/icon/IconPrinter';
+
+ const Icon = ;
+
+
+
+
+ )}
+ >
+
{text}
+
+
+
+```
+ - For buttons that use icons that do not convey a meaning, ensure they are marked as purely decorative.
+
+
+
+```jsx
+import ActionHeader from 'terra-action-header';
+import ContentContainer from 'terra-content-container';
+import Button, { IconButton, IconTypes } from 'terra-button';
+import DecoIconPrinter from 'terra-icon/lib/icon/decorative/IconPrinter';
+
+
+ const DecorativeIcon = ;
+
+
+
+
+ )}
+ >
+
{text}
+
+
+
+```
+
+ - Ensure any non-unique button label that is visually related to content on the page must be programmatically associated with its content. For example, a “learn more” button next to the word “allergies” must be appropriately associated with the word allergies.
+
+
+
+
+
+
+```jsx
+import ActionHeader from 'terra-action-header';
+import ContentContainer from 'terra-content-container';
+import IconPrinter from 'terra-icon/lib/icon/IconPrinter';
+import { IconButton, IconTypes } from 'terra-button';
+
+const MedIcon = ;
+const ResIcon = ;
+
+
+
+
+ )}
+ >
+
{Medications}
+
+
+
+
+ )}
+ >
+
{Results}
+
+
+
+```
+
+
+
+### Content Creator Considerations
+- Work with engineers to convey the page's structure to ensure proper heading levels are assigned.
+- When creating the text for the action header or any labels of interactable elements within it, ensure the words used are purposeful and help the user understand the context or purpose of the content.
+ - Heading text must accurately describe the content they represent.
+ - Button labels must be unique and descriptive of the actions they will initiate. The best practice is to use verbs that describe the action. Never use “OK," "Yes," or "No” for buttons. They are vague and can be confusing to the user.
+ - For any actionable element, avoid non-unique labels unless the elements perform the exact same function. For example, two print buttons that print the exact same document are fine. However, if the buttons print different documents, this would be an accessibility failure.
+ - If non-unique names cannot be avoided, inform the engineer of other text on the page that can be programmatically associated with other content on the page that may help describe a visual relationship. For example, multiple “Learn more” buttons on the page are placed in visual proximity to the item the user can learn more about. Ensure the first word(s) of the programmatic label match the visual label.
+ - When using icons, inform engineers when an icon is purely decorative. Otherwise, provide the engineer with meaningful alternate text which will serve as the accessible name.
+ - Ensure any icon used within Action Header is used to consistently represent the same functionality. Additionally, any alternate content used with an icon must be consistent for a predictable user experience. The alternate text should be consistent in wording based on the icon usage
+- Ensure the engineers understand the logical reading order of the page.
+- Never add unexpected behaviors to buttons that could cause a change of context on focus or activation of the button. Ensure buttons always meet the user’s expectations.
+- After coded, ensure all interactable elements receive keyboard focus in the user’s reading order and display a visible keyboard focus. Ensure the keyboard user does not get “trapped” somewhere on the page preventing them from the entire workflow.
+
+## Usability Expectations:
+Users do not expect Action Header to be actionable. They would, however, expect any actionable elements within Action Header to perform the expected action based on the label of the element.
+
+### Interaction Details
+Users do not expect Action Header to receive keyboard focus or be actionable. However, they would expect any actionable element within it to receive keyboard focus and behave in an expected and predictable manner.
+
+Mouse users expect the cursor to change to a hand with pointing finger when a Button or Link is hovered. Keyboard only users expect to see a visible keyboard focus indicator when an actionable element is in focus.
+
+### Keyboard Navigation
+
+The basic keyboard navigation expectations:
+
+| Key/Sequence | Description |
+|---|---|
+|*Tab*| Moves focus on and off interactable elements. User expects elements to receive focus in the logical reading order of the page. |
+|*Enter*| Executes Button action. |
+
+
+
+## Support Compliance:
+
+### Primary criteria related to Terra Action Headers
+- [1.3.1 Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html) — Supports
+ - Terra provides the ability for information, structure, and relationships to be programmatically determined.
+ - Engineers must ensure that the appropriate heading level is applied to convey the proper content structure of the action header on the page. Engineers must also programmatically associate non-unique controls with other words on the page to ensure visual relationships can be communicated via assistive technologies.
+ - Content creators must work with engineering to determine the appropriate heading level to match the structure within the page. Should also work with engineers to identify non-unique control labels (e.g., multiple "Close" buttons on the page" to ensure a programmatic association to other words in the interface to create more descriptive and unique accessible names for the controls.
+- [2.1.1 Keyboard](https://www.w3.org/WAI/WCAG21/Understanding/keyboard.html) — Supports
+ - Terra provides the ability for all interactable elements to receive focus, be interacted with, and be acted upon via keyboard.
+ - Engineers must ensure that all interactable elements can receive focus, be interacted with, and can be acted upon.
+- [2.4.1 Bypass Blocks](https://www.w3.org/WAI/WCAG21/Understanding/bypass-blocks.html) — Supports
+ - Terra provides the ability to create headings and labels that break content up into sections and provide meaningful structure that can be used by assistive technologies.
+ - Consuming teams must implement headings in a way that conveys the organizational structure of the page.
+ - Engineers, where appropriate, should include [landmark roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) (e.g.; role=”main”) to define regions of the page.
+- [2.4.6 Headings and Labels](https://www.w3.org/WAI/WCAG21/Understanding/headings-and-labels.html) — Supports
+ - Terra provides the ability to create headings and labels that are descriptive of their purpose.
+ - Engineers must implement meaningful text for headings and labels to accurately describe their purpose.
+ - Content creators must ensure the headings and labels provided to engineers accurately describe the purpose of the content they represent.
+- [2.4.7 Focus Visible](https://www.w3.org/WAI/WCAG21/Understanding/focus-visible.html) — Supports
+ - Terra provides the ability for actionable elements to receive visual focus.
+ - Engineers must ensure a visible keyboard focus is maintained on all interactive elements.
+ - Content creators must never remove the default keyboard focus on interactable controls.
+### Other accessibility criteria consuming teams are responsible for
+- [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG21/Understanding/non-text-content.html) — Supports
+ - Terra provides the ability to include alternate content on images and icons.
+ - Engineers must ensure appropriate alternate content is added to icons and non-text elements to convey any meaning or mark the icon as decorative if necessary.
+ - Content creators must provide Engineers with alternate content that conveys meaning to the user. See also 3.2.4 Consistent Identification. Content creators must also note any icons that are purely decorative so engineers can correctly codify decorative icons.
+- [1.4.10 Reflow](https://www.w3.org/WAI/WCAG21/Understanding/reflow.html) — Supports
+ - Terra provides the ability for components to reflow when the viewport is resized to 320x256 px without loss of information or function.
+ - Engineers must ensure content within Terra Action Header can reflow when the viewport is resized to 320 x 256 px without scrolling in two directions or loss of information or functionality.
+ - Content creators must consider the responsive nature of Terra Action Header and provide engineers guidance on how it should content should reflow when the viewport is resized to 320 x 256 px
+- [1.4.11 Non-Text Contrast](https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html) — Supports
+ - Terra provides components that, by default, meet color contrast requirements.
+ - Content creators must ensure any graphical elements used within Action Header that convey information meets a 3:1 color contrast ratio.
+- [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) — Supports
+ - Terra provides components that, by default, meet color contrast requirements.
+ - Content creators must ensure any content used within Action Header meets the proper color contrast ratios for text.
+- [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG21/Understanding/focus-order.html) — Supports
+ - Terra provides the ability for actionable components to receive focus in the order they are coded.
+ - Engineers must ensure that the focus order is expected and preserves page meaning. Code order should follow the logical reading order of the user. Though a TABINDEX attribute should not be required to ensure keyboard use, if used, never use TABINDEX higher than 0.
+ - Content creators should convey to the engineers the logical reading order of the page.
+- [2.5.2 Pointer Cancellation](https://www.w3.org/WAI/WCAG21/Understanding/pointer-cancellation.html) — Supports
+ - Terra components use the up event to perform actions.
+ - Engineers must ensure actionable controls always take on the up event.
+- [2.5.3 Label in Name](https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html) — Supports
+ - Terra provides the ability for programmatic labels to match visual labels.
+ - Engineers must ensure the programmatic label matches the visual label when interactable controls are included within Action Header. Ensure the visible control label is the first word of the programmatic label when associating the control to other words in visual proximity that further describe the control.
+ - Content creators must provide engineers guidance to ensure unique names for all interactive controls within Terra Action Header.
+- [3.2.1 On Focus](https://www.w3.org/WAI/WCAG21/Understanding/on-focus.html) — Supports
+ - Terra components do not cause a change of context on focus by default.
+ - Engineers must ensure that no unexpected change of context happens when interactive elements receive focus.
+ - Content creators must use standard, predictable design patterns that support user expectations.
+- [3.2.4 Consistent Identification](https://www.w3.org/WAI/WCAG21/Understanding/consistent-identification.html) — Supports
+ - Terra provides the ability for elements to be consistently identified.
+ - Engineers must ensure that elements used for the same function are identified consistently, both visually (same icon for the same functionality) and programmatically (the alternate content behind each image consistently represents the same functionality).
+ - Content creators must ensure any icons used are used to represent the same function consistently. Additionally, the alternate content used to describe icons must be consistent for users to understand their function predictably.
+- [4.1.1 Parsing](https://www.w3.org/WAI/WCAG21/Understanding/parsing.html) — Supports
+ - Terra components are tested and validated before release to ensure proper code parsing.
+ - Engineers must ensure their code is valid HTML.
+- [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html) — Supports
+ - Terra provides the ability for `Name` `Role`, and `Value` attributes to be programmatically determined so as to be read by screen readers.
+ - Engineers must ensure child elements added into Action Header have an accessible name, proper role, and value for the intended use.
+ - Content creators must provide engineers with names to appropriately identify controls added within Action Header.
+
+## Linked References:
+
+1. MDN contributors (02 February 2022). ["Accessibility Concerns | <h1>-<h6>: The HTML Section Heading elements"](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#accessibility_concerns). Mozilla. First published 15 September 2020. Retrieved 24 February 2022.
+2. WebAIM staff (01 May 2020). ["Semantic Structure: Regions, Headings, and Lists"](https://webaim.org/techniques/semanticstructure/#headings). WebAIM (Accessibility In Mind). Institute for Disability Research, Policy, and Practice. Utah State University. Last updated 01 May 2020. Retrieved 24 February 2022.
+3. Accessibility Guidelines Working Group (22 February 2022). ["Technique G130: Providing descriptive headings"](https://www.w3.org/WAI/WCAG21/Techniques/general/G130). World Wide Web Consortium. Last updated 22 February 2022. Retrieved 24 February 2022.
diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/action-header/UpgradeGuide.2.doc.mdx b/packages/terra-core-docs/src/terra-dev-site/doc/action-header/UpgradeGuide.4.doc.mdx
similarity index 100%
rename from packages/terra-core-docs/src/terra-dev-site/doc/action-header/UpgradeGuide.2.doc.mdx
rename to packages/terra-core-docs/src/terra-dev-site/doc/action-header/UpgradeGuide.4.doc.mdx
diff --git a/packages/terra-core-docs/src/terra-dev-site/doc/action-header/example/ActionHeaderNonUniqueIcon.jsx b/packages/terra-core-docs/src/terra-dev-site/doc/action-header/example/ActionHeaderNonUniqueIcon.jsx
new file mode 100644
index 00000000000..01f0d5c8f32
--- /dev/null
+++ b/packages/terra-core-docs/src/terra-dev-site/doc/action-header/example/ActionHeaderNonUniqueIcon.jsx
@@ -0,0 +1,41 @@
+import React from 'react';
+import ActionHeader from 'terra-action-header';
+import ContentContainer from 'terra-content-container';
+import Card from 'terra-card';
+import IconPrinter from 'terra-icon/lib/icon/IconPrinter';
+import Button from 'terra-button';
+
+const ActionHeaderNonUniqueIcon = () => {
+ const Medications = 'Patient Medications here..';
+ const Results = 'Patient Results here..';
+ const MedIcon = ;
+ const ResIcon = ;
+
+ return (
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteu
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteu