From 51f1dfb4736062230eed1cab17ddfda7e39335ad Mon Sep 17 00:00:00 2001 From: Andrea Del Rio Date: Tue, 7 Apr 2020 16:42:36 -0700 Subject: [PATCH] small a11y change --- .../__snapshots__/comment.test.tsx.snap | 40 +++++++++---------- .../__snapshots__/comment_event.test.tsx.snap | 24 +++++------ src/components/comment/comment_event.tsx | 16 ++++++-- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/components/comment/__snapshots__/comment.test.tsx.snap b/src/components/comment/__snapshots__/comment.test.tsx.snap index 52ab2e550b4..a2293959a2c 100644 --- a/src/components/comment/__snapshots__/comment.test.tsx.snap +++ b/src/components/comment/__snapshots__/comment.test.tsx.snap @@ -21,10 +21,10 @@ exports[`EuiComment is rendered 1`] = ` -
-
-
-
+ + `; @@ -63,10 +63,10 @@ exports[`EuiComment props event is rendered 1`] = ` -
-
-
-
+ + `; @@ -116,10 +116,10 @@ exports[`EuiComment props timelineIcon is rendered 1`] = ` -
-
-
-
+ + `; @@ -158,10 +158,10 @@ exports[`EuiComment props timestamp is rendered 1`] = ` -
-
-
- + + `; @@ -249,10 +249,10 @@ exports[`EuiComment renders a body 1`] = ` -
-
-
+
@@ -275,6 +275,6 @@ exports[`EuiComment renders a body 1`] = ` This is the body.

-
+ `; diff --git a/src/components/comment/__snapshots__/comment_event.test.tsx.snap b/src/components/comment/__snapshots__/comment_event.test.tsx.snap index d614313b717..2a8600d3077 100644 --- a/src/components/comment/__snapshots__/comment_event.test.tsx.snap +++ b/src/components/comment/__snapshots__/comment_event.test.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EuiCommentEvent is rendered 1`] = ` -
-
-
-
+ + `; exports[`EuiCommentEvent props event is rendered 1`] = ` -
-
-
-
+ + `; exports[`EuiCommentEvent props timestamp is rendered 1`] = ` -
-
-
- + + `; exports[`EuiCommentEvent props type is rendered 1`] = ` diff --git a/src/components/comment/comment_event.tsx b/src/components/comment/comment_event.tsx index 4005b66f980..1cff87e2bc0 100644 --- a/src/components/comment/comment_event.tsx +++ b/src/components/comment/comment_event.tsx @@ -50,9 +50,17 @@ export const EuiCommentEvent: FunctionComponent = ({ className ); + const Element = + type === 'regular' || (type === 'update' && children) ? 'figure' : 'div'; + + const HeaderElement = + type === 'regular' || (type === 'update' && children) + ? 'figcaption' + : 'div'; + return ( -
-
+ +
{username}
{event}
@@ -69,12 +77,12 @@ export const EuiCommentEvent: FunctionComponent = ({ ) : ( undefined )} -
+
{children ? (
{children}
) : ( undefined )} -
+ ); };