Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-abstract-modal] Customise Modal span text #2160

Merged
merged 5 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2,501 changes: 897 additions & 1,604 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/terra-abstract-modal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Changes to announce title of modal.

## 3.49.0 - (March 8, 2024)

* Changes
Expand Down
6 changes: 4 additions & 2 deletions packages/terra-abstract-modal/src/_ModalContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ const ModalContent = forwardRef((props, ref) => {
// Delete the closePortal prop that comes from react-portal.
delete customProps.closePortal;
delete customProps.fallbackFocus;
const beginLabelId = ariaLabel === 'Modal' ? 'Terra.AbstractModal.BeginModalDialog' : 'Terra.AbstractModal.BeginModalDialogTitle';
const endLabelId = ariaLabel === 'Modal' ? 'Terra.AbstractModal.EndModalDialog' : 'Terra.AbstractModal.EndModalDialogTitle';

const modalContent = (
<div
Expand All @@ -156,7 +158,7 @@ const ModalContent = forwardRef((props, ref) => {
>
<div className={modalContainerClassName} ref={setModalFocusElementRef} data-terra-abstract-modal-begin tabIndex="-1">
{(!isCalledFromNotificationDialog) && (
<FormattedMessage id="Terra.AbstractModal.BeginModalDialog">
<FormattedMessage id={beginLabelId} values={{ title: ariaLabel }}>
{text => {
// In the latest version of react-intl this param is an array, when previous versions it was a string.
let useText = text;
Expand All @@ -171,7 +173,7 @@ const ModalContent = forwardRef((props, ref) => {
)}
{children}
{(!isCalledFromNotificationDialog) && (
<FormattedMessage id="Terra.AbstractModal.EndModalDialog">
<FormattedMessage id={endLabelId} values={{ title: ariaLabel }}>
{text => {
// In the latest version of react-intl this param is an array, when previous versions it was a string.
let useText = text;
Expand Down
Loading
Loading