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

Doc update: Add "Icon only" buttons to the Button examples #1667

Closed
carmacleod opened this issue Jan 21, 2019 · 4 comments
Closed

Doc update: Add "Icon only" buttons to the Button examples #1667

carmacleod opened this issue Jan 21, 2019 · 4 comments

Comments

@carmacleod
Copy link
Contributor

If a button contains an icon and does not have any visible text, then the icon needs to have role="img" and a proper aria-label.

For example:

<button class="bx--btn bx--btn--primary" type="button">
    <svg class="bx--btn__icon" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"
role="img" aria-label="Add">
      <path d="M7 7H4v2h3v3h2V9h3V7H9V4H7v3zm1 9A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" fill-rule="evenodd" />
    </svg>
</button>

Would be great to add an example of an icon-only button to all of the Button examples, i.e. Primary Button, Secondary Button, Tertiary Button, Ghost Button, Danger button, Primary Danger button, Small Primary button, Small secondary button, Small tertiary button, Small ghost button, Small primary danger button, Small danger button.

@emyarod
Copy link
Member

emyarod commented Jan 22, 2019

cc @IBM/carbon-designers for a spec or mockup on how "icon only" buttons should appear as well as some copy describing the use case for this button variant

@jeanservaas
Copy link
Collaborator

@carmacleod and @emyarod

We know there's a need for this and have some sketches around specs and potential usage (see below) but the current Carbon v10 effort was to reskin current Carbon functionality... so we haven't added a lot of the variations that we'd like, and that we know we need for a more robust system.

Here's a sketch of some of our thinking around icon only buttons. Also, the security team has an icon- only button in their react storybook too if that helps. Also 2, check out the Carbon Data Table experimental component for some insitu examples of icon-only button functionality (especially the kit, which is set to release in a couple weeks).

Otherwise... Coming Soon! (I hope this helps)

image

@elizabethsjudd
Copy link
Contributor

Take a look at how WH approaches Icon-only buttons for accessibility: #1714 (comment)

This approach allows clarity for sighted users as well. The aria-label is only available for screen reader users but sighted users may want/need a textual description as well.

@carmacleod
Copy link
Contributor Author

Agree that a custom tooltip that appears on mouse hover or keyboard focus is an accessibility requirement for icon-only buttons. The WH approach is a good example.

@emyarod emyarod added this to the v10-update milestone Mar 19, 2019
joshblack pushed a commit to joshblack/carbon that referenced this issue May 2, 2019
* feat(Modal): align markup with vanilla experimental Modal

* test(Modal): update enzyme selectors

* test(Modal): update snapshot

* feat(Modal): add new icons for experimental component

* fix(Modal): directly import new icon

* chore: bump bundle size threshold

* feat(Modal): pass className and attributes to experimental icon

* feat(ComposedModal): add support for experimental icon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants