`;
@@ -54,8 +52,6 @@ exports[`EuiCommentTimeline props timelineIcon is rendered with timelineIconAria
- timelineIconAriaLabel
-
+ />
`;
diff --git a/src/components/timeline/__snapshots__/timeline.test.tsx.snap b/src/components/timeline/__snapshots__/timeline.test.tsx.snap
index 77109522b75..e4456d62f4e 100644
--- a/src/components/timeline/__snapshots__/timeline.test.tsx.snap
+++ b/src/components/timeline/__snapshots__/timeline.test.tsx.snap
@@ -23,9 +23,7 @@ exports[`EuiTimeline is rendered with items 1`] = `
- email
-
+ />
@@ -99,9 +97,7 @@ exports[`EuiTimeline props gutterSize l is rendered 1`] = `
- email
-
+ />
@@ -175,9 +171,7 @@ exports[`EuiTimeline props gutterSize m is rendered 1`] = `
- email
-
+ />
@@ -251,9 +245,7 @@ exports[`EuiTimeline props gutterSize xl is rendered 1`] = `
- email
-
+ />
diff --git a/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
index e8e6232d2de..e16981232db 100644
--- a/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
+++ b/src/components/timeline/__snapshots__/timeline_item.test.tsx.snap
@@ -52,9 +52,7 @@ exports[`EuiTimelineItem props EuiAvatar is passed as an icon 1`] = `
- dot
-
+ />
@@ -87,9 +85,7 @@ exports[`EuiTimelineItem props iconAriaLabel is rendered 1`] = `
- icon aria label
-
+ />
diff --git a/upcoming_changelogs/6071.md b/upcoming_changelogs/6071.md
new file mode 100644
index 00000000000..4ca399489dc
--- /dev/null
+++ b/upcoming_changelogs/6071.md
@@ -0,0 +1,5 @@
+- Removed the nested `aria-label` on the `EuiAvatar` icon to simplify a11y
+
+**Bug fixes**
+
+- Reverted the change `EuiCommentEvent.username` type from `ReactNode` to `string`
\ No newline at end of file
From 804592d05cf78d2937d8889a62916fecb2bd2c87 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Fri, 22 Jul 2022 18:37:00 +0100
Subject: [PATCH 07/15] Added missing `timelineIconAriaLabel` in copy to
clipboard example
---
src-docs/src/views/copy/copy_to_clipboard.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src-docs/src/views/copy/copy_to_clipboard.js b/src-docs/src/views/copy/copy_to_clipboard.js
index 972af1f1e84..8356fd2d13c 100644
--- a/src-docs/src/views/copy/copy_to_clipboard.js
+++ b/src-docs/src/views/copy/copy_to_clipboard.js
@@ -34,8 +34,8 @@ export default () => {
return (
Date: Mon, 25 Jul 2022 11:10:43 +0100
Subject: [PATCH 08/15] A11y callout
---
src-docs/src/views/comment/comment_example.js | 5 ++++-
src-docs/src/views/comment/comment_system.tsx | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src-docs/src/views/comment/comment_example.js b/src-docs/src/views/comment/comment_example.js
index b5dd4d4a7b2..2902a0ca48b 100644
--- a/src-docs/src/views/comment/comment_example.js
+++ b/src-docs/src/views/comment/comment_example.js
@@ -96,7 +96,10 @@ export const CommentListExample = {
For accessibility, it is highly recommended to provide a descriptive{' '}
aria-label or the ID of an external label to the{' '}
aria-labelledby prop of the{' '}
- EuiCommentList.
+ EuiCommentList. Every EuiComment{' '}
+ should have a timelineIconAriaLabel when a{' '}
+ timelineIcon is passed as an{' '}
+ IconType.
>
}
/>
diff --git a/src-docs/src/views/comment/comment_system.tsx b/src-docs/src/views/comment/comment_system.tsx
index ec5d03313ee..bdeb4181fc4 100644
--- a/src-docs/src/views/comment/comment_system.tsx
+++ b/src-docs/src/views/comment/comment_system.tsx
@@ -77,7 +77,8 @@ const initialComments: EuiCommentProps[] = [
},
{
username: 'system',
- timelineIcon: ,
+ timelineIcon: 'dot',
+ timelineIconAriaLabel: 'System',
event: 'pushed a new incident',
timestamp: 'on 4th March 2022',
eventColor: 'danger',
From 2b54cf73b07c7c2964b6dca35ecd5618ccbb7b5d Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Mon, 25 Jul 2022 11:43:13 +0100
Subject: [PATCH 09/15] Better callout text
---
src-docs/src/views/comment/comment_example.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src-docs/src/views/comment/comment_example.js b/src-docs/src/views/comment/comment_example.js
index 2902a0ca48b..d9bb3b647a2 100644
--- a/src-docs/src/views/comment/comment_example.js
+++ b/src-docs/src/views/comment/comment_example.js
@@ -96,10 +96,10 @@ export const CommentListExample = {
For accessibility, it is highly recommended to provide a descriptive{' '}
aria-label or the ID of an external label to the{' '}
aria-labelledby prop of the{' '}
- EuiCommentList. Every EuiComment{' '}
- should have a timelineIconAriaLabel when a{' '}
- timelineIcon is passed as an{' '}
- IconType.
+ EuiCommentList. A{' '}
+ timelineIconAriaLabel should be provided for
+ every EuiComment with or without a{' '}
+ timelineIcon as IconType.
>
}
/>
From d93c9726f4e9aafa0bf80c2a0d6f5d682d204666 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Mon, 25 Jul 2022 20:07:51 +0100
Subject: [PATCH 10/15] Update src/components/comment_list/comment_timeline.tsx
Co-authored-by: Constance
---
src/components/comment_list/comment_timeline.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/comment_list/comment_timeline.tsx b/src/components/comment_list/comment_timeline.tsx
index a56324c2dba..4f2c9f3620c 100644
--- a/src/components/comment_list/comment_timeline.tsx
+++ b/src/components/comment_list/comment_timeline.tsx
@@ -38,7 +38,7 @@ export const EuiCommentTimeline: FunctionComponent = ({
iconRender = (
From 0164dbf839997dc9b0d5f35c4bf8c0a3d8900c63 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Mon, 25 Jul 2022 20:08:40 +0100
Subject: [PATCH 11/15] Update src/components/comment_list/comment_timeline.tsx
Co-authored-by: Constance
---
src/components/comment_list/comment_timeline.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/comment_list/comment_timeline.tsx b/src/components/comment_list/comment_timeline.tsx
index 4f2c9f3620c..bf30e1fb499 100644
--- a/src/components/comment_list/comment_timeline.tsx
+++ b/src/components/comment_list/comment_timeline.tsx
@@ -49,7 +49,7 @@ export const EuiCommentTimeline: FunctionComponent = ({
iconRender = (
From cf76a1921c3af9f9a6cb42609c64c85a4d22fd67 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Mon, 25 Jul 2022 20:09:14 +0100
Subject: [PATCH 12/15] Update src/components/comment_list/comment_timeline.tsx
Co-authored-by: Constance
---
src/components/comment_list/comment_timeline.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/comment_list/comment_timeline.tsx b/src/components/comment_list/comment_timeline.tsx
index bf30e1fb499..261a20ea04c 100644
--- a/src/components/comment_list/comment_timeline.tsx
+++ b/src/components/comment_list/comment_timeline.tsx
@@ -19,7 +19,7 @@ export interface EuiCommentTimelineProps extends CommonProps {
timelineIcon?: ReactNode | EuiAvatarProps['iconType'];
/**
- * Specify an `aria-label` for the `timelineIcon` when passed as an `IconType` or when nothing is passed.
+ * Specify an `aria-label` and `title` for the `timelineIcon` when passed as an `IconType` or when nothing is passed.
* If no `aria-label` is passed we assume the icon is purely decorative.
*/
timelineIconAriaLabel?: string;
From 04525b6be3db4533415e63289a02fa118ca95db0 Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Tue, 26 Jul 2022 12:30:20 +0100
Subject: [PATCH 13/15] Renamed `timelineIcon` to `timelineAvatar`
---
src-docs/src/views/comment/comment.tsx | 2 +-
.../src/views/comment/comment_actions.tsx | 6 ++--
src-docs/src/views/comment/comment_avatar.tsx | 16 +++++-----
src-docs/src/views/comment/comment_example.js | 32 ++++++++-----------
.../src/views/comment/comment_flexible.tsx | 10 +++---
src-docs/src/views/comment/comment_list.tsx | 10 +++---
src-docs/src/views/comment/comment_props.tsx | 2 +-
src-docs/src/views/comment/comment_system.tsx | 19 ++++++-----
src-docs/src/views/copy/copy_to_clipboard.js | 2 +-
.../comment_timeline.test.tsx.snap | 12 +++----
src/components/comment_list/comment.test.tsx | 2 +-
src/components/comment_list/comment.tsx | 8 ++---
.../comment_list/comment_timeline.test.tsx | 14 ++++----
.../comment_list/comment_timeline.tsx | 28 ++++++++--------
upcoming_changelogs/6071.md | 7 +++-
15 files changed, 87 insertions(+), 83 deletions(-)
diff --git a/src-docs/src/views/comment/comment.tsx b/src-docs/src/views/comment/comment.tsx
index 861891c47ac..2ab37284da9 100644
--- a/src-docs/src/views/comment/comment.tsx
+++ b/src-docs/src/views/comment/comment.tsx
@@ -28,7 +28,7 @@ export default () => (
{
{
pushed a new incident malware detection
diff --git a/src-docs/src/views/comment/comment_avatar.tsx b/src-docs/src/views/comment/comment_avatar.tsx
index 7806a7e7bbb..ac646871d23 100644
--- a/src-docs/src/views/comment/comment_avatar.tsx
+++ b/src-docs/src/views/comment/comment_avatar.tsx
@@ -11,7 +11,7 @@ export default () => (
@@ -24,21 +24,21 @@ export default () => (
- The timelineIcon is using a dot{' '}
- icon.
+ The timelineAvatar is using a{' '}
+ dot icon.
>
}
/>
(
>
- The timelineIcon is using a custom{' '}
+ The timelineAvatar is using a custom{' '}
EuiAvatar.
diff --git a/src-docs/src/views/comment/comment_example.js b/src-docs/src/views/comment/comment_example.js
index d9bb3b647a2..41cd9509bee 100644
--- a/src-docs/src/views/comment/comment_example.js
+++ b/src-docs/src/views/comment/comment_example.js
@@ -52,11 +52,11 @@ const commentAvatarSnippet = [
`,
`
-
+
`,
`
-
+
{body}
@@ -97,9 +97,9 @@ export const CommentListExample = {
aria-label or the ID of an external label to the{' '}
aria-labelledby prop of the{' '}
EuiCommentList. A{' '}
- timelineIconAriaLabel should be provided for
+ timelineAvatarAriaLabel should be provided for
every EuiComment with or without a{' '}
- timelineIcon as IconType.
+ timelineAvatar as IconType.
>
}
/>
@@ -148,7 +148,7 @@ export const CommentListExample = {
- timelineIcon: Shows an icon that should
+ timelineAvatar: Shows an icon that should
indicate who is the author of the comment. To customize, pass a{' '}
string as a{' '}
EuiIcon['type'] or a{' '}
@@ -210,7 +210,7 @@ export const CommentListExample = {
playground: commentConfig,
},
{
- title: 'Timeline icon',
+ title: 'Timeline avatar',
source: [
{
type: GuideSectionTypes.JS,
@@ -223,28 +223,24 @@ export const CommentListExample = {
By default, each EuiComment shows an avatar with
- the initial letter of the username. It also
- uses the username for the avatar title
- attribute.
+ the userAvatar icon. A{' '}
+ timelineAvatarAriaLabel
+ should be provided when using this default option.
- If your EuiComment doesn't have a{' '}
- username, or if you don't want to use it
- for generating the title attribute and initials you can use the{' '}
- timelineIcon prop instead.
-
-
- You can also show an icon by passing to the{' '}
- timelineIcon any of the icon types that{' '}
+ You can customize your avatar by passing to the{' '}
+ timelineAvatar any of the icon types that{' '}
EuiIcon
{' '}
supports. The icon will show inside a subdued{' '}
avatar. Consider this option when showing a system update.
+ Providing a timelineAvatarAriaLabel is
+ recommended.
`;
-exports[`EuiCommentTimeline props timelineIcon is rendered with a string 1`] = `
+exports[`EuiCommentTimeline props timelineAvatar is rendered with a string 1`] = `
`;
-exports[`EuiCommentTimeline props timelineIcon is rendered with timelineIconAriaLabel 1`] = `
+exports[`EuiCommentTimeline props timelineAvatar is rendered with timelineAvatarAriaLabel 1`] = `
);
diff --git a/src/components/comment_list/comment.tsx b/src/components/comment_list/comment.tsx
index 5b830f68d74..393524b48be 100644
--- a/src/components/comment_list/comment.tsx
+++ b/src/components/comment_list/comment.tsx
@@ -26,8 +26,8 @@ export const EuiComment: FunctionComponent = ({
event,
actions,
timestamp,
- timelineIcon,
- timelineIconAriaLabel,
+ timelineAvatar,
+ timelineAvatarAriaLabel,
eventColor,
eventIcon,
eventIconAriaLabel,
@@ -40,8 +40,8 @@ export const EuiComment: FunctionComponent = ({
const mainIcon = (
);
diff --git a/src/components/comment_list/comment_timeline.test.tsx b/src/components/comment_list/comment_timeline.test.tsx
index d1a10890dd5..c20ac54bcbc 100644
--- a/src/components/comment_list/comment_timeline.test.tsx
+++ b/src/components/comment_list/comment_timeline.test.tsx
@@ -13,15 +13,15 @@ import { EuiAvatar } from '../avatar';
describe('EuiCommentTimeline', () => {
describe('props', () => {
- describe('timelineIcon', () => {
- it('defaults to a avatar with a `userAvatar` icon', () => {
+ describe('timelineAvatar', () => {
+ it('defaults to an avatar with a `userAvatar` icon', () => {
const component = render();
expect(component).toMatchSnapshot();
});
it('is rendered with a string', () => {
- const component = render();
+ const component = render();
expect(component).toMatchSnapshot();
});
@@ -29,7 +29,7 @@ describe('EuiCommentTimeline', () => {
it('is rendered with a ReactNode', () => {
const component = render(
{
expect(component).toMatchSnapshot();
});
- it('is rendered with timelineIconAriaLabel', () => {
+ it('is rendered with timelineAvatarAriaLabel', () => {
const component = render(
);
diff --git a/src/components/comment_list/comment_timeline.tsx b/src/components/comment_list/comment_timeline.tsx
index 261a20ea04c..01b4f561a1e 100644
--- a/src/components/comment_list/comment_timeline.tsx
+++ b/src/components/comment_list/comment_timeline.tsx
@@ -13,43 +13,43 @@ import { EuiAvatar, EuiAvatarProps } from '../avatar';
export interface EuiCommentTimelineProps extends CommonProps {
/**
* Main avatar that accompanies the comment. Should indicate who is the author of the comment.
- * Any `ReactNode`, but preferably `EuiAvatar`, or a `string` as an `EuiIcon['type']`.
- * If no `timelineIcon` is passed, the `userAvatar` icon will be used as the avatar.
+ * Any `ReactNode`, but preferably `EuiAvatar`, or a `string` as an `EuiAvatarProps['iconType']`.
+ * If no `timelineAvatar` is passed, the `userAvatar` icon will be used as the avatar.
*/
- timelineIcon?: ReactNode | EuiAvatarProps['iconType'];
+ timelineAvatar?: ReactNode | EuiAvatarProps['iconType'];
/**
- * Specify an `aria-label` and `title` for the `timelineIcon` when passed as an `IconType` or when nothing is passed.
- * If no `aria-label` is passed we assume the icon is purely decorative.
+ * Specify an `aria-label` and `title` for the `timelineAvatar` when passed as an `IconType` or when nothing is passed.
+ * If no `timelineAvatarAriaLabel` is passed we assume the avatar is purely decorative.
*/
- timelineIconAriaLabel?: string;
+ timelineAvatarAriaLabel?: string;
}
export const EuiCommentTimeline: FunctionComponent = ({
- timelineIcon,
- timelineIconAriaLabel,
+ timelineAvatar,
+ timelineAvatarAriaLabel,
}) => {
let iconRender;
const avatarClassName = 'euiCommentAvatar';
- const iconIsString = typeof timelineIcon === 'string';
+ const iconIsString = typeof timelineAvatar === 'string';
if (iconIsString) {
iconRender = (
);
- } else if (timelineIcon) {
- iconRender = timelineIcon;
+ } else if (timelineAvatar) {
+ iconRender = timelineAvatar;
} else {
iconRender = (
diff --git a/upcoming_changelogs/6071.md b/upcoming_changelogs/6071.md
index 4ca399489dc..084bfb9e457 100644
--- a/upcoming_changelogs/6071.md
+++ b/upcoming_changelogs/6071.md
@@ -1,5 +1,10 @@
- Removed the nested `aria-label` on the `EuiAvatar` icon to simplify a11y
+- Added `timelineAvatarAriaLabel` to `EuiComment`
**Bug fixes**
-- Reverted the change `EuiCommentEvent.username` type from `ReactNode` to `string`
\ No newline at end of file
+- Reverted the change `EuiCommentEvent.username` type from `ReactNode` to `string`
+
+**Breaking changes**
+
+- Renamed `timelineIcon` on `EuiComment` to `timelineAvatar`
From b099eae272ab26f4bcbb23b7c33c0e40b9a00d9e Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Tue, 26 Jul 2022 13:45:06 +0100
Subject: [PATCH 14/15] Enhacing description
---
src-docs/src/views/comment/comment_example.js | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src-docs/src/views/comment/comment_example.js b/src-docs/src/views/comment/comment_example.js
index 41cd9509bee..c32ebf6f0c9 100644
--- a/src-docs/src/views/comment/comment_example.js
+++ b/src-docs/src/views/comment/comment_example.js
@@ -148,17 +148,15 @@ export const CommentListExample = {
- timelineAvatar: Shows an icon that should
+ timelineAvatar: Shows an avatar that should
indicate who is the author of the comment. To customize, pass a{' '}
string as a{' '}
- EuiIcon['type'] or a{' '}
- ReactNode, preferably a{' '}
+ EuiIcon['type'] or a a{' '}
EuiAvatar
- . If no icon is provided, it will default to the{' '}
- username
- 's initials.
+ . If no avatar is provided, it will default to an avatar with a{' '}
+ userAvatar icon.
eventIcon: Icon that shows before the
From 6bb67eefaa5cff2b1707f4509d21d83e6f42d74b Mon Sep 17 00:00:00 2001
From: Elizabet Oliveira
Date: Tue, 26 Jul 2022 13:49:48 +0100
Subject: [PATCH 15/15] Enhancing description again
---
src-docs/src/views/comment/comment_example.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src-docs/src/views/comment/comment_example.js b/src-docs/src/views/comment/comment_example.js
index c32ebf6f0c9..6ef74e82cb7 100644
--- a/src-docs/src/views/comment/comment_example.js
+++ b/src-docs/src/views/comment/comment_example.js
@@ -155,8 +155,10 @@ export const CommentListExample = {
EuiAvatar
- . If no avatar is provided, it will default to an avatar with a{' '}
- userAvatar icon.
+ . Use in conjunction with{' '}
+ timelineAvatarAriaLabel to pass an aria label
+ to the avatar. If no avatar is provided, it will default to an
+ avatar with a userAvatar icon.