Skip to content

Commit

Permalink
Merge pull request #121 from w3c/card-click-fix
Browse files Browse the repository at this point in the history
handle click modifiers on cards
  • Loading branch information
deniak authored Sep 20, 2023
2 parents ae39891 + 7286be5 commit 533969b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions assets-src/js/main/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ let cardEnhancement = function () {

}

card.addEventListener('click', function() {
card.addEventListener('click', function(ev) {

if (ev.redispatched || ev.target === mainLink) {
return;
}
let noTextSelected = !window.getSelection().toString();
if (noTextSelected) {

mainLink.click();

const ev2 = new MouseEvent("click", ev);
ev2.redispatched = true;
mainLink.dispatchEvent(ev2);
}

});
Expand All @@ -43,4 +46,4 @@ let cardEnhancement = function () {

};

export {cardEnhancement};
export {cardEnhancement};

0 comments on commit 533969b

Please sign in to comment.