-
Notifications
You must be signed in to change notification settings - Fork 842
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
Eui image focus states #2287
Eui image focus states #2287
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM; pulled and tested functionality locally, would be best to have a designer approve as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is still missing hover and focus states while in the actual full screen mode.
Maybe also displaying a cross
icon on hover while in full screen mode will help to indicate that clicking will exit full screen?
As we discussed on zoom, I think the slight shadow change may be too subtle, at least for the focus state. See if there's a way to use the focus ring variables or mixin?
How'd you feel about tackling some of the other a11y issues with images as well? 🙏 TL;DR my proposed final markup (including the optional
So, why these changes?
Other notes
|
Thanks @myasonik ! However, I think all of that is out of scope of this PR. This PR is mainly to just address the missing |
@cchaos when I've seen your comment I was almost finishing the a11y suggestions. @myasonik and @cchaos here's what I implemented so far:
@cchaos can you review the new focus and hover states? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@myasonik @miukimiu It seems to me that there's an even simpler approach to the clickability other than using :focus-within
and absolute positioning the button.
The spec states that <figure>
can contain any flow content. A <button>
is a type of flow content. Therefore, we can wrap the <img>
tag with the <button>
but inside of <figure>
like so:
<figure role="figure" aria-label={figcaption}>
<button aria-label={`Show ${alt} image full screen`}>
<img src={src} alt={alt} />
{fullScreenIcon aria-hidden="true"}
</button>
<figcaption>{figcaption}</figcaption>
</figure>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I think pushing off the a11y work to another PR is a good idea as to separate the concerns and just focus on actually fixing the issue referenced.
Just saw a typo and want to make sure you've tested in other browsers, but visually it works well and the code looks good! 👍
cursor: pointer; | ||
&.euiImage--allowFullScreen { | ||
&:focus .euiImage__img { | ||
outline: 2px solid $euiFocusRingColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better 🎉
@miukimiu #2328 merged, so I'll get the conflicts sorted for you |
jenkins test this |
Summary
Closes #1983
Added hover and focus states when
allowFullScreen
is true in EuiImage.Non-clickable images were being wrapped by a button so I removed the button for images that aren't clickable.
Checklist