Skip to content

Commit

Permalink
Merge pull request #3272 from specify/issue-3269
Browse files Browse the repository at this point in the history
Allow to enter data into any search field after dragging
  • Loading branch information
maxpatiiuk committed Mar 31, 2023
2 parents ec0ad44 + 5241a33 commit 7ca0f27
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions specifyweb/frontend/js_src/lib/components/QueryBuilder/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ export function QueryFields({
distance: 4,
});

const interactiveElements = [
'button',
'a',
'input',
'select',
'textarea',
'.custom-select',
];

sortable.on('sortable:start', (event) => {
const target = event.dragEvent.originalEvent.target as HTMLElement;
if (
interactiveElements.some((element) => target.closest(element) !== null)
)
event.cancel();
});

sortable.on('sortable:stop', (event) => {
const newIndex = event.newIndex;
const oldIndex = event.oldIndex;
Expand Down

0 comments on commit 7ca0f27

Please sign in to comment.