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

IE11 - <a> element is hard to click with child lexicon-icon #1242

Closed
SpencerWoo opened this issue Oct 16, 2018 · 24 comments
Closed

IE11 - <a> element is hard to click with child lexicon-icon #1242

SpencerWoo opened this issue Oct 16, 2018 · 24 comments
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) comp: clay-css Issues related to Clay CSS status: next-release Issues that will enter into the next release type: breaking change Issues that caused some breaking change, whether in API or behavior change... type: enhancement Issues that are open to bring improvements or refinement of code

Comments

@SpencerWoo
Copy link
Member

SpencerWoo commented Oct 16, 2018

We originally added pointer-events:none to lexicon icons here 0bec132. This makes sense as lexicon-icons shouldn't have to trigger events however in IE11 the lexicon-icon "covers" the parent element preventing it from being clickable.

https://jsfiddle.net/L430qpmc/7/

EDIT :

  • I realize my example isn't the best but to properly explain the issue :
    The first image link on IE11 can only be clicked by a small sliver of the image. The expected behavior is being able to click the image link a more or less wherever the red background is. The blue background "blocks" the red from being clicked -- contrast the first image with the second image.
@pat270
Copy link
Member

pat270 commented Oct 17, 2018

Hey @SpencerWoo,

I'm actually ok with removing it, we just need to add the attribute focusable="false" to all our svgs. I think the Clay Soy Icon component does, but I don't think it's added in the icon taglib in CE/DXP.

This is a nitpick, but I'm not a fan of linking icons that way. The a tag is inline by default and doesn't grow with the content inside. If I'm linking an icon I like to change the display on the a tag to inline-block, inline-flex, or block. That way the anchor tag grows with the content and is clickable.

There is also a Clay CSS component that will do that for you, but you need to change the width, height and font-size if you want it to be something other than 32px. The font-size property will size the icon for you if you're using a Lexicon icon. See https://clayui.com/docs/css-framework/satellites/links.html

<a class="link-monospaced" style="width:50px;height:50px;font-size:50px;">
    <svg class="lexicon-icon"></svg>
</a>

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 17, 2018

@pat270 thank you for the quick response!

  • I realize my example isn't the best but to properly explain the issue :
    The first image on IE11 can only be clicked by a small sliver. The expected behavior is being able to click the a more or less wherever the red background is. The blue background "blocks" the red from being clicked -- contrast the first image with the second image.

I'm actually ok with removing it

  • Okay sweet, I'll look into adding the focusable attribute in the icon taglib on the Liferay side

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 17, 2018

Hi @pat270 looking at the code I think https://issues.liferay.com/browse/LPS-71422 added focusable="false" to the svgs in taglibs ATag, IconTag.

Assuming that's what we needed, are we good to remove pointer-events:none from lexicon icons? Or perhaps even just from <a> children?

a .lexicon-icon{
   pointer-events: auto
}

Let me know -- thanks!

pat270 added a commit to pat270/clay that referenced this issue Oct 17, 2018
…n-icon` use attribute `focusable="false" instead for IE11
@pat270
Copy link
Member

pat270 commented Oct 17, 2018

I removed it from lexicon-icon should be in when we release and put a new version in DXP.

SpencerWoo added a commit to SpencerWoo/clay that referenced this issue Oct 17, 2018
@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 17, 2018

Awesome, thanks. Also once it's in Master I'll also want to also put it on 1.x for 7.0.x.

@pat270
Copy link
Member

pat270 commented Oct 17, 2018

This isn't an issue in 1.x, there is no pointer-events: none declaration on .lexicon-icon in 1.x.

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 18, 2018

@pat270
Copy link
Member

pat270 commented Oct 19, 2018

ugh, you're right. I don't know what to do about #926. Reverting that change will introduce that again. You happen to have a link to the ticket @gregory-bretall was fixing or some example of the bug?

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 19, 2018

https://issues.liferay.com/browse/LPS-81456 tested and removing pointer-events:none unfortunately does reintroduce that bug again -- adding a portlet and hovering to view the tooltip.

EDIT : @gregory-bretall any ideas on how we can resolve https://issues.liferay.com/browse/LPS-81456 and https://issues.liferay.com/browse/LPS-86160?

@pat270
Copy link
Member

pat270 commented Oct 20, 2018

So the only workaround I'm able to find for removing pointer-events: none; is to remove/replace the title element from svg's added at aeac244 and in the aui:icon taglib https://github.com/liferay/liferay-portal/blame/master/util-taglib/src/com/liferay/taglib/aui/IconTag.java#L211-L213. I'm pretty sure it was added to pass some accessibility test. We might be able to replace title with aria-labelledby. We can do something like:

<svg aria-labelledby="uniqueSvgTitle">
    <desc id="uniqueSvgTitle"></desc>
</svg>

or

<svg aria-labelledby="the-svg-description"></svg>

I'm not sure if this will make it pass whatever test we are using. I'm including my references below:

https://www.w3.org/TR/SVG11/struct.html#DescriptionAndTitleElements
https://developer.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/

/cc @jbalsas @carloslancha

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Oct 25, 2018

hey @pat270 thanks for this. I missed your comment but I've come to a similar conclusion and just saw it now -- I think LPS-81456 is incorrect using pointer-events: none to address the tooltip issue. And I think it should be added back to resolve the IE11 issue LPS-86160 and the discrepancy shouldn't be LPS-81456 and LPS-86160 but rather between LPS-81456 and LPS-68726.

SpencerWoo added a commit to SpencerWoo/clay that referenced this issue Oct 26, 2018
'pointer-events:none' from '.lexicon-icon' use attribute
'focusable="false" instead for IE
@jbalsas
Copy link
Contributor

jbalsas commented Oct 26, 2018

@carloslancha, @marcoscv, could you please weigh in here? I remember we needed the <title> attribute in <svg> based on what we did on https://issues.liferay.com/browse/LPS-68726

@marcoscv-work
Copy link
Member

the title in an SVG is needed but only for accessibility validation reasons, we don't need icons focus because they will be associated with a group text, button or title attribute (when it is a link/button).

I'm not sure if this helps to take a solution.

@pat270
Copy link
Member

pat270 commented Oct 29, 2018

@marcoscv-work so we can't remove the title attribute from SVG?

@marcoscv-work
Copy link
Member

@pat270 We followed this to make the decision to add a title:
https://www.w3.org/TR/SVG11/struct.html#DescriptionAndTitleElements

But currently I'm not able to get an error with Axe plugin when I remove the title attribute in an SVG, so if you really need to remove 'title' we can make a deeper look

@pat270
Copy link
Member

pat270 commented Oct 30, 2018

To fix both issues mentioned by @SpencerWoo, we need to remove the title element from the svg.

This is another solution that seems most reasonable:

<svg aria-hidden="true" focusable="false" role="img"></svg>
<span class="sr-only">ellipsis-v</span>

from https://simplyaccessible.com/article/7-solutions-svgs/.

@SpencerWoo
Copy link
Member Author

SpencerWoo commented Nov 1, 2018

Okay so it sounds like we're good to remove pointer-events: none in Clay to fix this issue #1242 (LPS-86160).

And then we're trying to properly fix #926 (LPS-81456) without regressing LPS-68726 by replacing svg <title> with accessible alternatives. Potentially using <span class="sr-only"> instead?


Can we resolve this issue of pointer-events:none first/now? Or are we waiting to have the accessibility change complete

@marcoscv-work
Copy link
Member

It is Ok for me

@pat270
Copy link
Member

pat270 commented Nov 2, 2018

@SpencerWoo we should wait for the accessibility changes first.

@SpencerWoo
Copy link
Member Author

Okay, then is #1242 (comment) <span class="sr-only"> a suitable accessibility replacement for <title>? What about <desc>?

I'm not seeing where <title> is advocated in svgs in https://www.w3.org/TR/SVG11/struct.html#DescriptionAndTitleElements or LPS-68726 but I'd appreciate figuring this out.

@blzaugg
Copy link

blzaugg commented Nov 6, 2018

My $0.02.

I don't feel the bulk, indiscriminate, adding of any type of title/labelledby/etc at the SVG level is helping accessibility. Sure we may pass some test and meet the letter-of-the-law, but we aren't meeting the spirit-of-the-law. Those tests are aids, not targets.

For example, if I've got some user control for, uploading a user avatar. I may want these elements in the button.

  • icon (camera icon)
  • text ("Upload")

But I don't want my screen reading saying:

Button. Camera Icon. Upload.

More likely, I'd want something like:

Button. Upload User Avatar.

You can't accomplish this by labeling every SVG. This has to be done on a case-by-case basis, by adding a label to the button element, describing it in context.

Whoever implements the button is responsible to maintain accessibility in that context, not the SVG. The SVG is just an abstract visual aid. You cannot make it accessible abstractly.

pat270 added a commit to pat270/clay that referenced this issue Nov 9, 2018
…er` to wrap svg icons so we can have the icon name spoken for screen readers at the bare minimum
pat270 added a commit to pat270/clay that referenced this issue Nov 9, 2018
…stead of title

Fixes liferay#1242 - ClayIcon added properties ariaLabel and decorative
pat270 added a commit to pat270/clay that referenced this issue Nov 9, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 9, 2018
@pat270
Copy link
Member

pat270 commented Nov 9, 2018

Ok so I decided to wrap the svg icons in a span tag and use aria attributes to announce the icon names. It uses the icon name by default which is mostly unhelpful. I agree with @blzaugg that whoever is implementing the button/link/whatever should be responsible for maintaining accessibility. #1296 just provides a fallback if someone fails to do so.

The way to make links/buttons/whatever accessible is to add an aria-label attribute on the a, button, whatever element. For instances where the text inside the element is sufficient for describing the component you can set decorative to true in ClayIcon which will set the attribute aria-hidden="true" on the icon container.

pat270 added a commit to pat270/clay that referenced this issue Nov 12, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 12, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 13, 2018
…er` to wrap svg icons so we can have the icon name spoken for screen readers at the bare minimum
pat270 added a commit to pat270/clay that referenced this issue Nov 13, 2018
…stead of title

Fixes liferay#1242 - ClayIcon added properties ariaLabel and decorative
pat270 added a commit to pat270/clay that referenced this issue Nov 13, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 13, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 13, 2018
pat270 added a commit to pat270/clay that referenced this issue Nov 14, 2018
…r` to wrap svg icons so we can have the icon name spoken for screen readers at bare minimum
@marcoscv-work
Copy link
Member

I am not sure what were best place for this comment:
#1224 (comment)

@SpencerWoo
Copy link
Member Author

Any update on this one?

jbalsas added a commit that referenced this issue Nov 21, 2018
LEXICONCSS #1242 - SVG Icons added `.lexicon-icon-container` to wrap svg icons so we can have the icon name spoken for screen readers
jbalsas added a commit that referenced this issue Nov 22, 2018
…d focusable attribute. Use role=presentation instead and rely on usage to provide proper semantics when using/wrapping the icon
jbalsas added a commit that referenced this issue Nov 22, 2018
@matuzalemsteles matuzalemsteles added type: enhancement Issues that are open to bring improvements or refinement of code comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) comp: clay-css Issues related to Clay CSS type: breaking change Issues that caused some breaking change, whether in API or behavior change... labels Nov 23, 2018
matuzalemsteles added a commit to matuzalemsteles/clay that referenced this issue Nov 26, 2018
matuzalemsteles added a commit to matuzalemsteles/clay that referenced this issue Nov 27, 2018
matuzalemsteles pushed a commit to matuzalemsteles/clay that referenced this issue Nov 27, 2018
matuzalemsteles added a commit to matuzalemsteles/clay that referenced this issue Nov 27, 2018
matuzalemsteles added a commit to matuzalemsteles/clay that referenced this issue Nov 27, 2018
matuzalemsteles added a commit to matuzalemsteles/clay that referenced this issue Nov 28, 2018
jbalsas added a commit that referenced this issue Nov 29, 2018
 Fixes #1242 - Adds an alert informing the discontinuation of the title and focusable API
@matuzalemsteles matuzalemsteles added the status: next-release Issues that will enter into the next release label Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) comp: clay-css Issues related to Clay CSS status: next-release Issues that will enter into the next release type: breaking change Issues that caused some breaking change, whether in API or behavior change... type: enhancement Issues that are open to bring improvements or refinement of code
Projects
None yet
Development

No branches or pull requests

6 participants