Skip to content

Commit

Permalink
Merge pull request #269 from tjek/mr/incito_stop_prop
Browse files Browse the repository at this point in the history
Incito: Stop propagation when clicking links and carousel arrows
  • Loading branch information
mortenbo authored Dec 9, 2024
2 parents 18152a9 + 2014d01 commit 40ce139
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/incito-browser/incito.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ export default class Incito extends MicroEvent<{
const link = linkEl ? linkEl.dataset.link : null;

if (isDefinedStr(link)) {
e.stopPropagation();

window.open(link!, '_blank');
}

Expand All @@ -821,6 +823,8 @@ export default class Incito extends MicroEvent<{
const scrollLeft = carouselEl.scrollLeft;

if (carouselPrevEl) {
e.stopPropagation();

const newScrollLeft = scrollLeft - clientWidth;

if (newScrollLeft < 0) {
Expand All @@ -835,6 +839,8 @@ export default class Incito extends MicroEvent<{
});
}
} else if (carouselNextEl) {
e.stopPropagation();

const newScrollLeft = scrollLeft + clientWidth;

if (newScrollLeft >= scrollWidth) {
Expand Down

0 comments on commit 40ce139

Please sign in to comment.