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

Commit

Permalink
[terra-abstract-modal] Customise Modal span text (#2160)
Browse files Browse the repository at this point in the history
  • Loading branch information
saket2403 committed May 14, 2024
1 parent 7fbc549 commit 2eed005
Show file tree
Hide file tree
Showing 28 changed files with 1,273 additions and 1,794 deletions.
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

0 comments on commit 2eed005

Please sign in to comment.