Skip to content

Commit

Permalink
fix: can't get selector on certain elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Jan 27, 2023
1 parent 15fb0be commit f9c747e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/content/shared/SharedElementSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ function onKeydown(event) {
'selected'
);
}
function onClick(event) {
function onMousedown(event) {
event.preventDefault();
event.stopPropagation();
retrieveElementsRect(event, 'selected');
}
function onMessage({ data }) {
Expand All @@ -309,17 +311,17 @@ function onMessage({ data }) {
}
function attachListeners() {
window.addEventListener('scroll', onScroll);
document.addEventListener('click', onClick);
window.addEventListener('message', onMessage);
document.addEventListener('keydown', onKeydown);
window.addEventListener('mousemove', onMousemove);
document.addEventListener('mousedown', onMousedown);
}
function detachListeners() {
window.removeEventListener('scroll', onScroll);
document.removeEventListener('click', onClick);
window.removeEventListener('message', onMessage);
document.removeEventListener('keydown', onKeydown);
window.removeEventListener('mousemove', onMousemove);
document.removeEventListener('mousedown', onMousedown);
}
watch(
Expand Down

0 comments on commit f9c747e

Please sign in to comment.