Skip to content

Commit

Permalink
fix(chips): Make event handlers on Chip public (#2997)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonniezhou committed Jun 26, 2018
1 parent 1f5fd1f commit 963e0c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions packages/mdc-chips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ Method Signature | Description
`getShouldRemoveOnTrailingIconClick() => boolean` | Returns whether a trailing icon click should trigger exit/removal of the chip
`setShouldRemoveOnTrailingIconClick(shouldRemove: boolean) => void` | Sets whether a trailing icon click should trigger exit/removal of the chip
`beginExit() => void` | Begins the exit animation which leads to removal of the chip
`handleInteraction(evt: Event) => void` | Handles an interaction event on the root element
`handleTransitionEnd(evt: Event) => void` | Handles a transition end event on the root element
`handleTrailingIconInteraction(evt: Event) => void` | Handles an interaction event on the trailing icon element

#### `MDCChipSetFoundation`

Expand Down
12 changes: 6 additions & 6 deletions packages/mdc-chips/chip/foundation.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class MDCChipFoundation extends MDCFoundation {
* */
this.shouldRemoveOnTrailingIconClick_ = true;
/** @private {function(!Event): undefined} */
this.interactionHandler_ = (evt) => this.handleInteraction_(evt);
this.interactionHandler_ = (evt) => this.handleInteraction(evt);
/** @private {function(!Event): undefined} */
this.transitionEndHandler_ = (evt) => this.handleTransitionEnd_(evt);
this.transitionEndHandler_ = (evt) => this.handleTransitionEnd(evt);
/** @private {function(!Event): undefined} */
this.trailingIconInteractionHandler_ = (evt) => this.handleTrailingIconInteraction_(evt);
this.trailingIconInteractionHandler_ = (evt) => this.handleTrailingIconInteraction(evt);
}

init() {
Expand Down Expand Up @@ -142,7 +142,7 @@ class MDCChipFoundation extends MDCFoundation {
* Handles an interaction event on the root element.
* @param {!Event} evt
*/
handleInteraction_(evt) {
handleInteraction(evt) {
if (evt.type === 'click' || evt.key === 'Enter' || evt.keyCode === 13) {
this.adapter_.notifyInteraction();
}
Expand All @@ -152,7 +152,7 @@ class MDCChipFoundation extends MDCFoundation {
* Handles a transition end event on the root element.
* @param {!Event} evt
*/
handleTransitionEnd_(evt) {
handleTransitionEnd(evt) {
// Handle transition end event on the chip when it is about to be removed.
if (this.adapter_.eventTargetHasClass(/** @type {!EventTarget} */ (evt.target), cssClasses.CHIP_EXIT)) {
if (evt.propertyName === 'width') {
Expand Down Expand Up @@ -197,7 +197,7 @@ class MDCChipFoundation extends MDCFoundation {
* prevent the ripple from activating on interaction with the trailing icon.
* @param {!Event} evt
*/
handleTrailingIconInteraction_(evt) {
handleTrailingIconInteraction(evt) {
evt.stopPropagation();
if (evt.type === 'click' || evt.key === 'Enter' || evt.keyCode === 13) {
this.adapter_.notifyTrailingIconInteraction();
Expand Down

0 comments on commit 963e0c1

Please sign in to comment.