Skip to content

Commit 864ae46

Browse files
committed
fix a11y bug
1 parent 79bf6e9 commit 864ae46

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/react-core/src/components/Progress/ProgressContainer.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,15 @@ export const ProgressContainer: React.FunctionComponent<ProgressContainerProps>
9595
}
9696
}, [tooltip]);
9797

98+
const _isTruncatedAndString = isTitleTruncated && typeof title === 'string';
9899
const Title = (
99100
<div
100-
className={css(
101-
progressStyle.progressDescription,
102-
isTitleTruncated && typeof title === 'string' && progressStyle.modifiers.truncate
103-
)}
101+
className={css(progressStyle.progressDescription, _isTruncatedAndString && progressStyle.modifiers.truncate)}
104102
id={`${parentId}-description`}
105-
aria-hidden="true"
106-
onMouseEnter={isTitleTruncated && typeof title === 'string' ? onFocus : null}
107-
onFocus={isTitleTruncated && typeof title === 'string' ? onFocus : null}
108-
{...(isTitleTruncated && typeof title === 'string' && { tabIndex: 0 })}
103+
aria-hidden={_isTruncatedAndString ? null : 'true'}
104+
onMouseEnter={_isTruncatedAndString ? onFocus : null}
105+
onFocus={_isTruncatedAndString ? onFocus : null}
106+
{...(_isTruncatedAndString && { tabIndex: 0 })}
109107
ref={titleRef}
110108
>
111109
{title}

0 commit comments

Comments
 (0)