Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiNotificationEvent] Render icon instead of button if onRead is undefined #4881

Merged
merged 13 commits into from
Jun 22, 2021

Conversation

wenchonglee
Copy link
Contributor

@wenchonglee wenchonglee commented Jun 15, 2021

Changes for #4791

Summary

How it looks like, with the bottom notification not having onRead
notif

I initially had an if-else statement in <EuiNotificationEventReadButton> to render an icon or button. But we'd have double the useEuiI18n hooks and I decided to create another internal component <EuiNotificationEventReadIcon>

A couple of concerns I have because I'm very unfamiliar with accessibility and i18n:

Do let me know what you think, or feel free to close the PR if it is something that should be resolved by the Eui team instead.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@elizabetdev
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wenchonglee,

The PR is looking good. 🎉

Can you improve the following description that you can find here
src-docs/src/views/notification_event/notification_event_example.js?

flexible-component@2x

And then there's a small change that I'm requesting in the code.

<EuiIcon
type="dot"
aria-label={iconAriaLabel}
title={iconTitle}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 We could only use the title prop here. It would create an aria-labelledby attribute and wire it to the title tag inside the SVG. But then I think just read/unread as a title wouldn't be too descriptive for screen readers. And {eventName} is read would be good for screen readers but too long to display on hover.

So I think the way you did it by adding aria-label and title is better. What do you think @myasonik?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miukimiu Your thinking on it perfect – exactly! 👍

@wenchonglee wenchonglee requested a review from elizabetdev June 17, 2021 14:42
@elizabetdev
Copy link
Contributor

jenkins test this

@elizabetdev
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

@elizabetdev
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a few more things. After you fix those I'm happy to approve the PR. We should also wait for @myasonik to check the a11y and then we good to merge. 😄

eventName,
}) => {
const classesReadState = classNames('euiNotificationEventReadIcon', {
'euiNotificationEventReadButton--isRead': isRead,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In EUI we don't use a class that belongs to a different component. So this class should be specific to this component:

Suggested change
'euiNotificationEventReadButton--isRead': isRead,
'euiNotificationEventReadIcon--isRead': isRead,

Then you need to add the styles .euiNotificationEventReadIcon--isRead svg into src/components/notification/_notification_event_read_icon.scss

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! I wasn't sure about the practice for isolating classes.
I definitely missed the types though 😅

@elizabetdev
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

@elizabetdev
Copy link
Contributor

jenkins test this

@elizabetdev
Copy link
Contributor

jenkins test this

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wenchonglee,

I fixed the icon to be vertical centered.

Event icon@2x

I also tested locally in Chrome, Safari, Edge, and Firefox, and LGTM! 🎉

Let's just wait for @myasonik approval and we'll be ready to merge.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the slow review but this PR is great 🚀 Ship it!

@elizabetdev
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4881/

@elizabetdev elizabetdev merged commit 1928958 into elastic:master Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants