mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 21:19:41 -06:00
FIX: ignore enter key press on "move to existing post" search field (#12210)
UX: do not set focus on auto-selected radio option
This commit is contained in:
parent
0e65c2b3c8
commit
ae70a23525
@ -2,7 +2,7 @@ import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { next } from "@ember/runloop";
|
||||
import { next, schedule } from "@ember/runloop";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
|
||||
export default Component.extend({
|
||||
@ -39,6 +39,22 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
schedule("afterRender", () => {
|
||||
$("#choose-topic-title").keydown((e) => {
|
||||
if (e.keyCode === 13) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
$("#choose-topic-title").off("keydown");
|
||||
},
|
||||
|
||||
@observes("topicTitle")
|
||||
topicTitleChanged() {
|
||||
this.setProperties({
|
||||
@ -113,7 +129,6 @@ export default Component.extend({
|
||||
this.set("selectedTopicId", topic.id);
|
||||
next(() => {
|
||||
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
||||
document.getElementById(`choose-topic-${topic.id}`).focus();
|
||||
});
|
||||
if (this.topicChangedCallback) {
|
||||
this.topicChangedCallback(topic);
|
||||
|
Loading…
Reference in New Issue
Block a user