Closed samuelgoff closed 3 years ago
I like this enhancement idea! The code contribution for this enhancement should be straightforward, would you like to take a stab at it? @samuelgoff
Thanks Shimi, I already have it done & PR ready, but the battery on my laptop died before I could submit. Trekking home from getting the COVID vaccine, then I’ll be able to plug in & submit the PR.
Thanks,
Sam
Sent from my iPhone
On Apr 8, 2021, at 1:47 PM, Shimi @.***> wrote:
I like this enhancement idea! The code contribution for this enhancement should be straightforward, would you like to take a stab at it? @samuelgoff
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I like this enhancement idea! The code contribution for this enhancement should be straightforward, would you like to take a stab at it? @samuelgoff
Hi @ShimiSun, hopefully this works for you.
Buttons
and iconButtons
quite often need atip
value anda11yTitle
value that is (or could suitably be) identical. The result is you end up repeating yourself, or declaring aconst
just so you only have to repeat the reference rather than the literal (or derivation), but it's still redundant.Expected Behavior
If
Button
tip
attribute is populated with a string buta11yTitle
is not, thena11yTitle
should get default value from the Buttontip
value. Not only does this solve a DRY opportunity, but this also ensures that if thea11yTitle
value isn't populated, it will still allow the component to add a useful/meaningfularia-label
value, improving accessibility with no additional effort on the part of the developer.Actual Behavior
Create a
Button
and populatetip
with a string but omit supplying ana11yTitle
value, then elicitTip
visibility so you can examine the DOM. Note that thearia-label
is not populated in the resultingbutton
DOM.URL, screen shot, or Codepen exhibiting the issue
https://codesandbox.io/s/grommet-v2-template-forked-w597x?file=/index.js
Steps to Reproduce
Button
tip
with a string but omit supplying ana11yTitle
valueTip
visibility so you can examine the DOMaria-label
is not populated in the resultingbutton
DOM.Your Environment