Skip to content

Commit

Permalink
Merge pull request #1694 from jdi-testing/issue_1661-disable-rightcli…
Browse files Browse the repository at this point in the history
…ck-locator-selection

Issue 1661: disable right click locator selection
  • Loading branch information
KateDronova authored Mar 29, 2024
2 parents 8edc838 + 93229e6 commit bc967b2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "JDN — Page Object Generator",
"description": "JDN – helps Test Automation Engineer to create Page Objects in the test automation framework and speed up test development",
"devtools_page": "index.html",
"version": "3.15.15",
"version": "3.15.16",
"icons": {
"128": "icon128.png"
},
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdn-ai-chrome-extension",
"version": "3.15.15",
"version": "3.15.16",
"description": "jdn-ai chrome extension",
"scripts": {
"start": "webpack --watch --env devenv",
Expand Down
1 change: 1 addition & 0 deletions src/pageServices/contentScripts/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ export const runContextMenu = () => {

const highlightTarget = event.target.closest('[jdn-highlight=true]');
if (!highlightTarget) return;
if (highlightTarget && !highlightTarget.classList.contains('jdn-active')) return;

event.preventDefault();

Expand Down
13 changes: 7 additions & 6 deletions src/pageServices/contentScripts/selectable.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,15 @@ export const selectable = () => {

const menuTarget = e.target.closest(".context-menu");
if (menuTarget) return;

self.options.start && self.options.start(e);
if (self.options.key && !e[self.options.key]) return;
self.options.onDeselect && self.selectedItems.size && self.options.onDeselect(Array.from(self.selectedItems));

document.body.classList.add("s-noselect");

if (e.button === 2) return;

self.ipos = [e.pageX, e.pageY];
if (!rb()) {
const gh = document.createElement("div");
Expand Down Expand Up @@ -221,7 +224,7 @@ export const selectable = () => {
const selected = new Set();
const deselected = new Set();
const a = rb();
if (!a) return;
if (!a) return; // if no elements are chosen

delete self.ipos;
document.body.classList.remove("s-noselect");
Expand All @@ -240,6 +243,7 @@ export const selectable = () => {
el.classList.add(s);
}
};

if (isPlainClick(a)) {
const highlightTarget = e.target.closest("[jdn-highlight=true]:not([id^='jdn-overlay'])");
const isActiveTarget = highlightTarget && highlightTarget.classList.contains(self.options.selectedClass);
Expand All @@ -253,9 +257,6 @@ export const selectable = () => {
if (isActiveGroup) self.removePreviousSelection([highlightTarget.id]);
/** make target active, if it's still not **/
if (!isActiveTarget) toggleActiveClass(highlightTarget);
} else {
/** with "more button" used, active class is always converted **/
toggleActiveClass(highlightTarget);
}
/* single click outside highlight cancels all selections */
} else if (!highlightTarget) self.removePreviousSelection();
Expand Down

0 comments on commit bc967b2

Please sign in to comment.