mirror of
https://github.com/discourse/discourse.git
synced 2025-04-03 05:39:41 +08: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 Component from "@ember/component";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { next } from "@ember/runloop";
|
import { next, schedule } from "@ember/runloop";
|
||||||
import { searchForTerm } from "discourse/lib/search";
|
import { searchForTerm } from "discourse/lib/search";
|
||||||
|
|
||||||
export default Component.extend({
|
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")
|
@observes("topicTitle")
|
||||||
topicTitleChanged() {
|
topicTitleChanged() {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
@ -113,7 +129,6 @@ export default Component.extend({
|
|||||||
this.set("selectedTopicId", topic.id);
|
this.set("selectedTopicId", topic.id);
|
||||||
next(() => {
|
next(() => {
|
||||||
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
||||||
document.getElementById(`choose-topic-${topic.id}`).focus();
|
|
||||||
});
|
});
|
||||||
if (this.topicChangedCallback) {
|
if (this.topicChangedCallback) {
|
||||||
this.topicChangedCallback(topic);
|
this.topicChangedCallback(topic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user