diff --git a/components/lib/password/Password.js b/components/lib/password/Password.js index 5ee43644e5..69b79c2c3f 100644 --- a/components/lib/password/Password.js +++ b/components/lib/password/Password.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 { CSSTransition } from '../csstransition/CSSTransition'; import { ESC_KEY_HANDLING_PRIORITIES, useDisplayOrder, useGlobalOnEscapeKey, useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect } from '../hooks/Hooks'; @@ -272,7 +272,7 @@ export const Password = React.memo( ZIndexUtils.clear(overlayRef.current); }); - const onToggleMaskKeyDown= (e) => { + const onToggleMaskKeyDown = (e) => { return e.key === 'Enter' ? toggleMask() : ''; }; @@ -286,7 +286,8 @@ export const Password = React.memo( tabIndex: props.tabIndex || '0', className: cx('hideIcon'), onClick: toggleMask, - onKeyDown: onToggleMaskKeyDown + onKeyDown: onToggleMaskKeyDown, + 'aria-label': ariaLabel('toggleMaskLabel') || 'Toggle Password Mask' }, ptm('hideIcon') ); @@ -298,7 +299,8 @@ export const Password = React.memo( tabIndex: props.tabIndex || '0', className: cx('showIcon'), onClick: toggleMask, - onKeyDown: onToggleMaskKeyDown + onKeyDown: onToggleMaskKeyDown, + 'aria-label': ariaLabel('toggleMaskLabel') || 'Toggle Password Mask' }, ptm('showIcon') );