Skip to content

Commit

Permalink
supress enter keypresses in HTML input search fields (new UI)
Browse files Browse the repository at this point in the history
see #295
  • Loading branch information
Bernhard B committed Sep 15, 2021
1 parent 20dca80 commit a3b126b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/webui/html/components/annotationbrowseform.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="row" id="annotation-query-search-container" v-if="visible">
<div class="four wide column"></div>
<div class="eight wide center aligned column">
<form class="ui form segment">
<form class="ui form segment" onsubmit="return false;" v-on:keyup="onKeyup"> <!-- do not handle enter key presses in HTML form-->
<div class="field">
<p class="default-text">Search for annotation tasks you are interested in</p>
<div class="ui action input">
Expand Down
9 changes: 8 additions & 1 deletion src/webui/js/components/annotationbrowseform.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ AnnotationBrowseFormComponent = {
this.searchQuery = query;
this.search();
}
},
onKeyup: function(event) {
if (event.key == "Enter") {
event.preventDefault();
event.target.blur();
this.search();
}
}
},
beforeDestroy: function() {
Expand All @@ -141,4 +148,4 @@ AnnotationBrowseFormComponent = {
EventBus.$on("unifiedModeImageGridCurrentlyShownImagesUpdated", this.onUnifiedModeImageGridCurrentlyShownImagesUpdated);
EventBus.$on("loadAnnotationBrowseFormLabels", this.onLoadAnnotationBrowseFormLabels);
}
};
};

0 comments on commit a3b126b

Please sign in to comment.