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

feat(icon-button): Add new package #2748

Merged
merged 32 commits into from
May 25, 2018

Conversation

williamernest
Copy link
Contributor

fixes: #2673

@kfranqueiro kfranqueiro self-requested a review May 16, 2018 18:59
@codecov-io
Copy link

codecov-io commented May 16, 2018

Codecov Report

Merging #2748 into master will decrease coverage by 0.06%.
The diff coverage is 97.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2748      +/-   ##
==========================================
- Coverage   98.48%   98.42%   -0.07%     
==========================================
  Files          98       98              
  Lines        4232     4186      -46     
  Branches      538      532       -6     
==========================================
- Hits         4168     4120      -48     
- Misses         64       66       +2
Impacted Files Coverage Δ
packages/mdc-icon-button/constants.js 100% <100%> (ø)
packages/mdc-icon-button/index.js 100% <100%> (ø)
packages/mdc-icon-button/foundation.js 96.55% <96.55%> (ø)
packages/mdc-icon-toggle/index.js
packages/mdc-icon-toggle/constants.js
packages/mdc-icon-toggle/foundation.js

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 16a6890...2a95b2c. Read the comment docs.

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending partial review 'cause I have to jump into a meeting soon.

demos/card.html Outdated
@@ -58,7 +58,7 @@ <h3 class="demo-card__subtitle mdc-typography--subtitle2">by Kurt Wagner</h3>
<button class="mdc-button mdc-card__action mdc-card__action--button">Bookmark</button>
</div>
<div class="mdc-card__action-icons">
<i class="mdc-icon-toggle material-icons mdc-card__action mdc-card__action--icon"
<i class="mdc-icon-button material-icons mdc-card__action mdc-card__action--icon"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also add mdc-icon-button to the other mdc-card__action--icon elements to make sure it works for them? (Which would also affect MDC Card documentation, and might mean there are styles we can pull out of Card if mdc-icon-button already covers it now)

Need to be careful to only instantiate MDCIconButtonToggle for the actual toggle buttons though, and not all icon buttons... This might actually point to a developer ergonomics problem, if it becomes difficult to programmatically distinguish things we want to be toggle-able from things that aren't.

@@ -0,0 +1,271 @@
<!DOCTYPE html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate that this file was added (especially in this case where it's effectively replacing an existing component), but is it feasible to fast-follow this PR with screenshot testing page(s)?

@@ -0,0 +1,271 @@
<!DOCTYPE html>
<!--
Copyright 2016 Google Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to do a copyright year check on new files

<div class="toggle-example">
<h2 class="mdc-typography--headline6">Disabled Buttons</h2>
<div class="demo-wrapper">
<span class="mdc-icon-button mdc-icon-button--disabled material-icons"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment RE potentially limiting to button and a elements. We shouldn't need to support a disabled CSS modifier class at all that way, and I suspect we wouldn't need aria-disabled then either (which is missing here but present on others below).

role="button"
aria-label="Transit directions"
aria-pressed="false"
tabindex="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These shouldn't have tabindex if they're disabled.

role="button"
aria-label="Add to favorites"
aria-pressed="false"
tabindex="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a and button elements shouldn't need tabindex, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a needs tabIndex if there isn't an href attribute.

<h2 class="mdc-typography--headline6">SVG Icon</h2>
<div class="demo-wrapper">
<button class="mdc-icon-button"
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

role="button" is redundant for button elements, right?

aria-label="Add to favorites"
aria-pressed="false"
tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need width and height hard-coded inline here or should CSS cover this?

@@ -153,6 +153,7 @@
"floating-label",
"form-field",
"grid-list",
"icon-button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure your commit message is valid when merging (your PR title has a space instead of hyphen)

@@ -19,4 +19,7 @@ $mdc-button-horizontal-padding: 8px;
$mdc-button-contained-horizontal-padding: 16px;
$mdc-dense-button-height: 32px;

$mdc-button-icon-padding: 12px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming these don't belong here anymore? They're never used in this PR AFAICT.

@williamernest williamernest changed the title feat(icon button): Add new package feat(icon-button): Add new package May 16, 2018
Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to literally move the icon-toggle tests, we should add a deprecation notice to its README a la toolbar.


<ul class="icon-list">
<li class="icon-list-item icon-list-item--spec">
<a href="https://material.io/guidelines/components/buttons.html#buttons-toggle-buttons">Material Design guidelines: Toggle buttons</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an old link. AFAIK there's no new equivalent though... we might want to notify/ask designers about that.

<a href="https://material.io/guidelines/components/buttons.html#buttons-toggle-buttons">Material Design guidelines: Toggle buttons</a>
</li>
<li class="icon-list-item icon-list-item--link">
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enter an issue in the catalog repo to add a page for this?

(It would not get merged to master and deployed until we have a new MDC Web release we can update it to; I have thoughts about release process between these packages that I need to formalize and share with the team.)

favorite
</button>
```
> Note: The MDC Icon Button can be used with `<button>`, `<span>`, `<i>`, and `<a>` tags.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, we may want to restrict this to button / a which make the most sense

```
### JavaScript Instantiation

The icon button will work without Javascript, but you can enhance it to hav ea ripple effect by instantiating `MDCRipple` on the root element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have ea -> have a

```

```js
var toggleButton = new mdc.iconButton.MDCIconToggle(document.getElementById('add-to-favorites'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace MDCIconToggle with MDCIconButtonToggle across this readme

* @param {string} dataAttr
* @return {!IconToggleState}
*/
parseJsonDataAttr_(dataAttr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this was inherited from icon-toggle, but serious question: which do you think is better for developer ergonomics within HTML?

Current:

data-toggle-off='{"content": "favorite_border", "label": "Add to favorites"}'

This requires JSON within HTML, which in turn requires using single-quotes around the attribute value to easily have double-quotes in the value for valid JSON

Alternative:

data-toggle-off-content="favorite_border"
data-toggle-off-label="Add to favorites"

This requires writing more separate attributes (and requires us to read more separate attributes in our code) but doesn't require the use of JSON within HTML and thus the atypical use of single quotes around attribute values.

The downside is this could lead to as many as 6 total attributes (up from 2), and converting existing icon-toggles to icon-button would no longer be a single find/replace. IMO the upside is it's both more readable and writeable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the data attribute redesign as a follow-up issue... but we should really do that before merging this to master and publishing this package to avoid immediate breaking changes.

It should be possible for you to create a centralized branch for mdc-icon-button changes and edit this PR to target that branch.

initRipple_() {
const adapter = Object.assign(MDCRipple.createAdapter(this), {
isUnbounded: () => true,
isSurfaceActive: () => this.foundation_.isKeyboardActivated(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we think the keyboard code is safe to remove (see earlier comment), we only need to set unbounded, which we can do without needing to patch the adapter (just set ripple.unbounded = true immediately after instantiating).


.mdc-icon-button {
@include mdc-icon-button-base_;
@include mdc-states(on-surface);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why we're setting this to on-surface here? That seems like the correct setting for card, but wouldn't be the correct setting in general? Also, we're setting up states but not ink color?

"url": "https://github.com/material-components/material-components-web.git"
},
"dependencies": {
"@material/animation": "^0.34.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used?

color: inherit;
text-decoration: none;
cursor: pointer;
@include mdc-icon-button-base_();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for doing this rather than adding the mdc-button-icon class directly? I'm a bit iffy on depending on "internal" mixins across packages, though maybe there's precedent for that which I'm forgetting.

If there's a convincing argument for this being done this way, maybe we should rename that mixin to be public, sort of like mdc-ripple-surface is.

@@ -92,5 +91,23 @@
// Both .mdc-top-app-bar__icon and .mdc-top-app-bar__navigation-icon share all styles except for
// horizontal padding.
@mixin mdc-top-app-bar-icon_() {
@include mdc-icon-button-base_();
@include mdc-ripple-surface;
Copy link
Contributor

@kfranqueiro kfranqueiro May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you revert this with the intent of adopting mdc-icon-button within top app bar in a separate PR? I'm a bit confused since I do see card changes in this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Card was previously using icon-toggle, so I went ahead and updated that one. Top app bar doesn't need to change with this PR.

@kfranqueiro
Copy link
Contributor

kfranqueiro commented May 17, 2018

Just noticed an issue in IE 11 which only affects Icon Button (not Icon Toggle):

Icons are initially misaligned. When pressed, they move both vertically and horizontally.

Icon Button (new):

image

Icon Toggle (old):

image

I tried removing the display style in Icon Button for argument's sake (since in the old demo page, the display: inline-block from material-icons is actually taking precedence), but that didn't seem to make any difference.

(For that matter, is there anything we can do to add specificity to our selectors for styles that conflict with .material-icons to ensure ours take precedence? We've had to do that in e.g. MDC Button and Chips.)


.mdc-icon-button {
@include mdc-icon-button-base_;
@include mdc-states;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this line make sense standalone? Should we include mdc-icon-button-ink-color with a default value instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following. We use mdc-states without passing a parameter in tab, list, card and ripple.

@@ -20,6 +20,7 @@
$mdc-theme-primary: $material-color-amber-300;
$mdc-theme-secondary: $material-color-pink-400;
$mdc-theme-background: $material-color-grey-900;
$mdc-theme-surface: $material-color-grey-900;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in this PR? Do other themes also need updates?

@@ -26,7 +26,8 @@
}

.demo-theme-list {
@include mdc-theme-prop(color, text-primary-on-light);
@include mdc-theme-prop(color, on-surface);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in this PR?

<a href="https://material.io/design/components/buttons.html#toggle-button">Material Design guidelines: Toggle buttons</a>
</li>
<li class="icon-list-item icon-list-item--link">
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we go ahead and update this URL now under the assumption that the next time these docs are pushed to material.io, the new page will exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can wait on updating the URL until after we get the catalog updated. It might not happen completely in sync, and a simple doc update change would be a fast PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're referencing an appspot URL above in the article asset div; do you want to update that to match this?

```
### JavaScript Instantiation

The icon button will work without Javascript, but you can enhance it to have a ripple effect by instantiating `MDCRipple` on the root element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javascript -> JavaScript

demos/card.html Outdated
tabindex="0"
role="button"
</button>
<button class="material-icons mdc-icon-button mdc-card__action mdc-card__action--icon"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: mdc-icon-button first everywhere


/** @return {!Element} */
get iconEl_() {
const {'iconInnerSelector': sel} = this.root_.dataset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iconInnerSelector can be removed from here and tests; it's not even properly documented for icon-toggle and we've removed mention of nested elements. Either do it here or file a follow-up issue.

Copy link
Contributor Author

@williamernest williamernest May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to support font awesome. Without an inner icon element, font awesome wouldn't work correctly.

@@ -21,7 +21,7 @@ import {assert} from 'chai';

import {supportsCssVariables} from '../../../packages/mdc-ripple/util';
import {createMockRaf} from '../helpers/raf';
import {MDCIconToggle, MDCIconToggleFoundation} from '../../../packages/mdc-icon-toggle';
import {MDCIconButtonToggle, MDCIconButtonToggleFoundation} from '../../../packages/mdc-icon-button';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this file to mdc-icon-button-toggle.test.js?

this.isHandlingKeydown_ = false;

this.keydownHandler_ = /** @private {!EventListener} */ ((/** @type {!KeyboardKey} */ evt) => {
if (isSpace(evt)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log removal of keyboard handling as a follow-up issue if you want. I think especially considering we now have both with-JS and no-JS variants of icon button, it makes more sense for the two to operate consistently anyway.

* @param {string} dataAttr
* @return {!IconToggleState}
*/
parseJsonDataAttr_(dataAttr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the data attribute redesign as a follow-up issue... but we should really do that before merging this to master and publishing this package to avoid immediate breaking changes.

It should be possible for you to create a centralized branch for mdc-icon-button changes and edit this PR to target that branch.

super(Object.assign(MDCIconButtonToggleFoundation.defaultAdapter, adapter));

/** @private {boolean} */
/** @private {boolean} */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated annotation, FYI


display: inline-block;
position: relative;
align-items: center;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove align-items and justify-content since they no longer apply now that display is inline-block

}
}

@mixin mdc-icon-button-font-size($font-size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure I follow why we need this rather than just adding font-size to mdc-icon-button-size and making it all one mixin.

<div class="toggle-example">
<h2 class="mdc-typography--headline6">Using Material Icons</h2>
<div class="demo-wrapper">
<a href="#"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest changing this to button like the rest in this section. It doesn't make sense for a link to be a toggle, because links navigate.

@@ -35,12 +35,12 @@
<header class="mdc-toolbar mdc-toolbar--fixed demo-toolbar">
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<button class="material-icons mdc-toolbar__menu-icon demo-drawer-toggle">menu</button>
<button class="material-icons mdc-toolbar__menu-icon demo-drawer-toggle mdc-icon-button" data-mdc-ripple-is-unbounded>menu</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the data attribute here is needed specifically for the Ripple JS... we might want to add a note in the JS instantiation section of the README about this (and that it's not needed for Icon Toggle since that handles it itself).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used instead of .mdc-ripple-surface for just an icon-button. This is required for the Ripple to instantiate an unbounded ripple since we're using the same function to instantiate bounded and unbounded ripples.

<a href="https://material.io/design/components/buttons.html#toggle-button">Material Design guidelines: Toggle buttons</a>
</li>
<li class="icon-list-item icon-list-item--link">
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're referencing an appspot URL above in the article asset div; do you want to update that to match this?


## Usage within Web Frameworks

If you are using a JavaScript framework, such as React or Angular, you can create a Icon Toggle for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a -> an, Icon Toggle -> Icon Button Toggle


If you are using a JavaScript framework, such as React or Angular, you can create a Icon Toggle for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).

### `MDCIconToggleAdapter`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDCIconButtonToggleAdapter

`removeAttr(name: string) => void` | Removes the attribute `name` on the root element.
`notifyChange(evtData: {isOn: boolean}) => void` | Broadcasts a change notification, passing along the `evtData` to the environment's event handling system. In our vanilla implementation, Custom Events are used for this.

### Foundation: `MDCIconToggleFoundation`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDCIconButtonToggleFoundation

@mixin mdc-icon-button-base_() {
@include mdc-ripple-surface;
@include mdc-ripple-radius-unbounded;
@include mdc-icon-button-font-size(24px);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference variable here? Otherwise the variable is unused.

//

$mdc-icon-button-size: 24px;
$mdc-icon-button-padding: 12px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is unused because it's calculated in the default mixin parameter.

/* eslint no-unused-vars: [2, {"args": "none"}] */

/**
* Adapter for MDC Icon Toggle. Provides an interface for managing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDC Icon Button Toggle

@@ -0,0 +1,25 @@
{
"name": "@material/icon-button",
"description": "The Material Components for the icon button component",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "web" after "the"?

setDisabled(isDisabled) {
this.disabled_ = isDisabled;

const {ARIA_DISABLED} = MDCIconButtonToggleFoundation.strings;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to maintain aria-disabled anymore since we're stating that disabled state applies only to buttons directly, right? (Also affects tests, and probably renders this constant unused)

@kfranqueiro
Copy link
Contributor

Can we add a deprecation notice to mdc-icon-toggle's readme in here? Perhaps we should also remove demo links from it in preparation for the demo being moved in catalog?


.demo-icon-button-large {
@include mdc-icon-button-font-size(36px);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at end of file

@include mdc-states-base-color(#de442c);
@include mdc-states-hover-opacity(.09);
@include mdc-states-focus-opacity(.26);
@include mdc-states-press-opacity(.35);
}

.demo-icon-button-large {
@include mdc-icon-button-font-size(36px);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mdc-icon-button-size

import {MDCRipple} from '../../../packages/mdc-ripple';
import {cssClasses} from '../../../packages/mdc-ripple/constants';

function setupTest({tabIndex = undefined, useInnerIconElement = false} = {}) {
const root = document.createElement(useInnerIconElement ? 'span' : 'i');
const root = document.createElement(useInnerIconElement ? 'span' : 'button');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the outer element always be the button? I thought font-awesome required the inner icon element to be i.

data-toggle-on-label="Remove from favorites"
data-toggle-off-content="favorite_border"
data-toggle-off-label="Add to favorites">
favorite_borde
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: the last r got deleted

aria-label="Add to favorites" tabindex="0"
data-toggle-on='{"label": "Remove from favorites", "content": "favorite"}'
data-toggle-off='{"label": "Add to favorites", "content": "favorite_border"}'
<button class="mdc-icon-toggle material-icons"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still says mdc-icon-toggle; I think it should say mdc-icon-button?

Also, remove trailing space after favorite_border


<!--<div class="article__asset">
<a class="article__asset-link"
href="https://material.io/design/components/buttons.html#toggle-button">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to link to a demo, not a design article.

--- | ---
`data-toggle-<TOGGLE STATE>-label` | The value to apply to the element's "aria-label" attribute.
`data-toggle-<TOGGLE STATE>-content` | The text content to set on the element. Note that if an inner icon is used, the text content will be set on that element instead.
`data-toggle-<TOGGLE STATE>-class` | A css class to apply to the icon element. The same rules regarding inner icon elements described for `content` apply here as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: capitalize CSS

### Icons

The icon button can be used with a standard icon library or an `svg`. The icon button toggle should only be used with
an standard icon library. We recommend you use [Material Icons](https://material.io/icons/) from Google Fonts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update link to material.io/tools/icons to skip redirect

Property | Value Type | Description
--- | --- | ---
`on` | Boolean | Sets the toggle state to the provided `isOn` value.
`disabled` | Boolean | Sets the icon toggle to the `disabled` state.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this no longer exists in the component and tests.

```js
import {MDCRipple} from '@material/ripple';

const iconButtonRipple = new MDCRipple(document.querySelector('.mdc-icon-button'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include another line here for iconButtonRipple.unbounded = true in order to get the ripple to look correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for "mdc-icon-button"
3 participants