Skip to content

Commit

Permalink
Add event payload
Browse files Browse the repository at this point in the history
  • Loading branch information
MisRob committed Nov 15, 2024
1 parent 9396a65 commit 6ecb5f9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/cards/KCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,12 @@
onThumbnailError() {
this.thumbnailError = true;
},
clickHandler() {
clickHandler(event) {
/**
* Emitted when a card is clicked
* Emitted when a card is clicked or pressed with enter.
* Contains the DOM event in the payload.
*/
this.$emit('click');
this.$emit('click', event);
if (this.to) {
this.$router.push(this.to);
}
Expand All @@ -505,13 +506,13 @@
*/
this.$emit('hover', e);
},
onEnter() {
this.clickHandler();
onEnter(event) {
this.clickHandler(event);
},
onMouseDown() {
this.mouseDownTime = new Date().getTime();
},
onClick() {
onClick(event) {
if (this.isSkeleton) {
return;
}
Expand All @@ -524,7 +525,7 @@
// which is not typically interpreted as a click event so do not run
// the click handler.
if (mouseUpTime - this.mouseDownTime < 200) {
this.clickHandler();
this.clickHandler(event);
} else {
return;
}
Expand Down

0 comments on commit 6ecb5f9

Please sign in to comment.