diff --git a/CHANGELOG.md b/CHANGELOG.md index eb5a1e85658..944de205d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ **Bug fixes** - Fixed `EuiCodeEditor` custom mode file error by initializing with existing mode ([#2616](https://github.com/elastic/eui/pull/2616)) +- Removed `EuiIcon` default titles ([#2632](https://github.com/elastic/eui/pull/2632)) ## [`17.1.1`](https://github.com/elastic/eui/tree/v17.1.1) diff --git a/src/components/accordion/__snapshots__/accordion.test.tsx.snap b/src/components/accordion/__snapshots__/accordion.test.tsx.snap index 311e985c2a7..576221f0924 100644 --- a/src/components/accordion/__snapshots__/accordion.test.tsx.snap +++ b/src/components/accordion/__snapshots__/accordion.test.tsx.snap @@ -29,16 +29,13 @@ exports[`EuiAccordion behavior closes when clicked twice 1`] = ` > {titleDisplayed} { } else { const Svg = icon; - // If it's an empty icon it gets aria-hidden true - const hideIconEmpty = icon === empty && { 'aria-hidden': true }; + // If it's an empty icon, or if there is no aria-label, aria-labelledby, or title it gets aria-hidden true + const isAriaHidden = + icon === empty || + !( + this.props['aria-label'] || + this.props['aria-labelledby'] || + this.props.title + ); + const hideIconEmpty = isAriaHidden && { 'aria-hidden': true }; let ariaLabel: any; // If no aria-label or aria-labelledby is provided the title will be default - - if (!this.props['aria-label'] && !this.props['aria-labelledby']) { - ariaLabel = { 'aria-label': titleDisplayed }; + if ( + !this.props['aria-label'] && + !this.props['aria-labelledby'] && + title + ) { + ariaLabel = { 'aria-label': title }; } return ( @@ -628,8 +630,8 @@ export class EuiIcon extends PureComponent { style={optionalCustomStyles} tabIndex={tabIndex} focusable={focusable} - title={titleDisplayed} role="img" + title={title} {...rest} {...hideIconEmpty} {...ariaLabel} diff --git a/src/components/image/__snapshots__/image.test.tsx.snap b/src/components/image/__snapshots__/image.test.tsx.snap index ceabd9d27c8..68532048b81 100644 --- a/src/components/image/__snapshots__/image.test.tsx.snap +++ b/src/components/image/__snapshots__/image.test.tsx.snap @@ -34,7 +34,6 @@ exports[`EuiImage is rendered and allows full screen 1`] = ` />