-
Notifications
You must be signed in to change notification settings - Fork 2.1k
refactor(chips): Register handlers in component instead of foundation #3146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume there should also be newly-public methods added to the readme to indicate what functions need to be called for what events?
Whoops, nice catch @kfranqueiro ! |
Codecov Report
@@ Coverage Diff @@
## master #3146 +/- ##
==========================================
- Coverage 98.31% 98.13% -0.19%
==========================================
Files 101 101
Lines 4454 4444 -10
Branches 585 585
==========================================
- Hits 4379 4361 -18
- Misses 75 83 +8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me pending 1 comment.
packages/mdc-chips/chip/index.js
Outdated
this.handleTransitionEnd_ = (evt) => this.foundation_.handleTransitionEnd(evt); | ||
this.handleTrailingIconInteraction_ = (evt) => this.foundation_.handleTrailingIconInteraction(evt); | ||
|
||
['click', 'keydown'].forEach((evtType) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making this array and the one below into variables will read better, and then you can share it in the destroy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I'm not sure why we omitted touch events from the first array...so I added them in and used the same array for chip interaction and trailing icon interaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we omitted touch events from the first array
Maybe because the code in handleInteraction
is a no-op for anything besides click or keyboard events anyway? I don't think adding touch events will be harmful but they'll also never do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point. The touch events are also a no-op in handleTrailingIconInteraction
, so I'm just gonna remove them altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🤖 Beep boop! Screenshot test reportCommit 7f3b794 vs. No diffs! 💯🎉 |
🤖 Beep boop! Screenshot test reportCommit 4773a74 vs. No diffs! 💯🎉 |
Part of #2813