fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Icon: Doesn't consume 'aria-labelledby' from ImageProps

Open HalcyonPride opened this issue 7 years ago • 11 comments

Environment Information

  • Package version(s): 7.18.1
  • Browser and OS versions: N.A.

Please provide a reproduction of the bug in a codepen:

https://codepen.io/anon/pen/xvdEPY

Actual behavior:

Nothing.

Expected behavior:

aria-labelledby - and similar HTML attributes - in imageProps should be applied to the Icon's <i> element.

Priorities and help requested:

Are you willing to submit a PR to fix? No

Requested priority: Normal; potentially an accessibility issue

Products/sites affected: N.A.

HalcyonPride avatar Jul 30 '19 23:07 HalcyonPride

Hi @HalcyonPride thanks for submitting this and referencing the codePen example! I was able to repro this and will work on getting it fixed.

marygans avatar Jul 31 '19 16:07 marygans

Noticed this issue since I'm also working on some Icon changes (#9884). I'm not sure that hoisting aria-* attributes from imageProps to the icon root makes sense. If you want those attributes applied to the root, you can apply them there directly (see https://codepen.io/ecraig12345/pen/WNewvMd?editors=0010). Is there a case where you're not able to apply the attributes to the root for some reason?

ecraig12345 avatar Aug 14 '19 17:08 ecraig12345

@ecraig12345, I can't say - I'm just basing my comments off what's already written in Icon.base.tsx: image

HalcyonPride avatar Aug 14 '19 23:08 HalcyonPride

All that's doing is determining whether the container should be aria-hidden based on the provided imageProps. It's not directly passing any props through.

ecraig12345 avatar Aug 15 '19 03:08 ecraig12345

Yes, but it's implying that aria-labelledby etc. is passed via imageProps. Otherwise, why is it trying to read those attributes from imageProps?

Conversely, this code needs to be updated if we expect aria-* attributes to be passed via the icon root instead.

HalcyonPride avatar Aug 15 '19 19:08 HalcyonPride

Hmm. I am seeing aria attributes passed through. If aria-labelledby is passed into imageProps would fall to the img element. https://codepen.io/dzearing/pen/KKPeVQe?editors=1011

If you need the aria-labelledby to live on the container div, you could apply the attribute on the Icon itself:

    <Icon 
      iconName="upload" 
      className="ms-IconExample" 
      aria-labelledby='on the i'
      imageProps={ {
        src: 'https://www.fillmurray.com/100/100',
        'aria-labelledby': "on the img"
      } }
    />

But I think the aria-hidden logic certainly adds some confusion.

I'm not totally familiar with this area; it seems like we should focus the aria attributes in one place; sticking them on the container makes sense, and at a minimum for aria-hidden logic above, reading them from there and falling back to current behavior would make more sense.

So proposal would be:

Adjust the aria-hidden calculation to first pull labelled-by from the root.

Thoughts?

dzearing avatar Sep 12 '19 16:09 dzearing

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fabric React!

msft-github-bot avatar Sep 16 '19 17:09 msft-github-bot

@dzearing, that sounds good to me 😊 thanks for the feedback! @leddie24, could you please revise your code per David's proposal?

HalcyonPride avatar Sep 17 '19 02:09 HalcyonPride

:tada:This issue was addressed in #10526, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

msft-github-bot avatar Sep 23 '19 12:09 msft-github-bot

:tada:This issue was addressed in #10526, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

msft-github-bot avatar Sep 23 '19 12:09 msft-github-bot

:tada:This issue was addressed in #10526, which has now been successfully released as [email protected].:tada:

Handy links:

msft-github-bot avatar Sep 23 '19 12:09 msft-github-bot