diff --git a/components/lib/multiselect/MultiSelectHeader.js b/components/lib/multiselect/MultiSelectHeader.js
index 415f9d8744..97c27def5b 100644
--- a/components/lib/multiselect/MultiSelectHeader.js
+++ b/components/lib/multiselect/MultiSelectHeader.js
@@ -1,5 +1,5 @@
import * as React from 'react';
-import { localeOption } from '../api/Api';
+import { ariaLabel } from '../api/Api';
import { Checkbox } from '../checkbox/Checkbox';
import { useMergeProps } from '../hooks/Hooks';
import { CheckIcon } from '../icons/check';
@@ -158,7 +158,7 @@ export const MultiSelectHeader = React.memo((props) => {
{
type: 'button',
className: cx('closeButton'),
- 'aria-label': localeOption('close'),
+ 'aria-label': ariaLabel('close'),
onClick: props.onClose
},
getPTOptions('closeButton')
diff --git a/components/lib/overlaypanel/OverlayPanel.js b/components/lib/overlaypanel/OverlayPanel.js
index aece64f365..c406b71408 100644
--- a/components/lib/overlaypanel/OverlayPanel.js
+++ b/components/lib/overlaypanel/OverlayPanel.js
@@ -1,5 +1,5 @@
import * as React from 'react';
-import PrimeReact, { PrimeReactContext, localeOption } from '../api/Api';
+import PrimeReact, { PrimeReactContext, ariaLabel } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { ESC_KEY_HANDLING_PRIORITIES, useDisplayOrder, useGlobalOnEscapeKey, useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect } from '../hooks/Hooks';
@@ -239,13 +239,12 @@ export const OverlayPanel = React.forwardRef((inProps, ref) => {
);
const icon = props.closeIcon || ;
const closeIcon = IconUtils.getJSXIcon(icon, { ...closeIconProps }, { props });
- const ariaLabel = props.ariaCloseLabel || localeOption('close');
const closeButtonProps = mergeProps(
{
type: 'button',
className: cx('closeButton'),
onClick: (e) => onCloseClick(e),
- 'aria-label': ariaLabel
+ 'aria-label': props.ariaCloseLabel || ariaLabel('close')
},
ptm('closeButton')
);
diff --git a/components/lib/sidebar/Sidebar.js b/components/lib/sidebar/Sidebar.js
index dc7aac2883..71e4ec17f9 100644
--- a/components/lib/sidebar/Sidebar.js
+++ b/components/lib/sidebar/Sidebar.js
@@ -1,5 +1,5 @@
import * as React from 'react';
-import PrimeReact, { PrimeReactContext, localeOption } from '../api/Api';
+import PrimeReact, { PrimeReactContext, ariaLabel } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { ESC_KEY_HANDLING_PRIORITIES, useDisplayOrder, useEventListener, useGlobalOnEscapeKey, useMergeProps, useMountEffect, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
@@ -160,14 +160,13 @@ export const Sidebar = React.forwardRef((inProps, ref) => {
});
const createCloseIcon = () => {
- const ariaLabel = props.ariaCloseLabel || localeOption('close');
const closeButtonProps = mergeProps(
{
type: 'button',
ref: closeIconRef,
className: cx('closeButton'),
onClick: (e) => onClose(e),
- 'aria-label': ariaLabel
+ 'aria-label': props.ariaCloseLabel || ariaLabel('close')
},
ptm('closeButton')
);
diff --git a/components/lib/toast/ToastMessage.js b/components/lib/toast/ToastMessage.js
index 7c7f4f24a8..d07ff204e6 100644
--- a/components/lib/toast/ToastMessage.js
+++ b/components/lib/toast/ToastMessage.js
@@ -1,5 +1,5 @@
import * as React from 'react';
-import { localeOption } from '../api/Locale';
+import { ariaLabel } from '../api/Api';
import { useMergeProps, useTimeout } from '../hooks/Hooks';
import { CheckIcon } from '../icons/check';
import { ExclamationTriangleIcon } from '../icons/exclamationtriangle';
@@ -88,14 +88,13 @@ export const ToastMessage = React.memo(
const icon = _closeIcon || ;
const closeIcon = IconUtils.getJSXIcon(icon, { ...buttonIconProps }, { props });
- const ariaLabel = props.ariaCloseLabel || localeOption('close');
const closeButtonProps = mergeProps(
{
type: 'button',
className: cx('message.closeButton'),
onClick: onClose,
- 'aria-label': ariaLabel
+ 'aria-label': props.ariaCloseLabel || ariaLabel('close')
},
getPTOptions('closeButton', parentParams),
ptmo(pt, 'closeButton', { ...params, hostName: props.hostName })
diff --git a/components/lib/treeselect/TreeSelect.js b/components/lib/treeselect/TreeSelect.js
index da7121293d..8f04fe831d 100644
--- a/components/lib/treeselect/TreeSelect.js
+++ b/components/lib/treeselect/TreeSelect.js
@@ -1,5 +1,5 @@
import * as React from 'react';
-import PrimeReact, { PrimeReactContext, localeOption } from '../api/Api';
+import PrimeReact, { PrimeReactContext, localeOption, ariaLabel } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { ChevronDownIcon } from '../icons/chevrondown';
@@ -770,7 +770,7 @@ export const TreeSelect = React.memo(
className: cx('closeButton'),
onKeyDown: (event) => onHeaderElementKeyDown(event, true),
onClick: hide,
- 'aria-label': localeOption('close')
+ 'aria-label': ariaLabel('close')
},
ptm('closeButton')
);