If you want to only trigger the event on clicking on the field in the modal, try to replace the selector:
input[data-fieldname="variation"][data-doctype="Shipping List"]
with:
.form-in-grid input[data-fieldname="variation"][data-doctype="Shipping List"]