Skip to content

A platform for community discussion. Free, open, simple.

FIX: `move-topics` topic search losing focus (#25116)

Isaac Janzenc689eeef3182
diff --git a/app/assets/javascripts/discourse/app/components/choose-topic.js b/app/assets/javascripts/discourse/app/components/choose-topic.js
index 2b6c87aa74f..eb36332c7c0 100644
--- a/app/assets/javascripts/discourse/app/components/choose-topic.js
+++ b/app/assets/javascripts/discourse/app/components/choose-topic.js
@@ -3,8 +3,10 @@ import { action } from "@ember/object";
import { isEmpty } from "@ember/utils";
import { searchForTerm } from "discourse/lib/search";
import { INPUT_DELAY } from "discourse-common/config/environment";
-import discourseDebounce from "discourse-common/lib/debounce";
-import discourseComputed, { observes } from "discourse-common/utils/decorators";
+import discourseComputed, {
+ debounce,
+ observes,
+} from "discourse-common/utils/decorators";
export default Component.extend({
loading: null,
@@ -69,7 +71,7 @@ export default Component.extend({
oldTopicTitle: this.topicTitle,
});
- this.searchDebounced(this.topicTitle);
+ this.search(this.topicTitle);
},
@discourseComputed("label")
@@ -86,10 +88,7 @@ export default Component.extend({
this.set("loading", false);
},
- searchDebounced(title) {
- discourseDebounce(this, this.search, title, INPUT_DELAY);
- },
-
+ @debounce(INPUT_DELAY)
search(title) {
if (!this.element || this.isDestroying || this.isDestroyed) {
return;
diff --git a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs
index e9cf2409476..e6afc45051a 100644
--- a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs
+++ b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs
@@ -95,7 +95,6 @@
{{/if}}
{{else}}
-
<div class="radios">
{{#if this.canSplitTopic}}
<label class="radio-label" for="move-to-new-topic">
@@ -133,16 +132,17 @@
</div>
{{#if this.existingTopic}}
- <p>{{html-safe
+ <p>
+ {{html-safe
(i18n
"topic.merge_topic.instructions" [email protected]
)
- }}</p>
+ }}
+ </p>
<form>
<ChooseTopic
@currentTopicId={{@model.topic.id}}
@selectedTopicId={{this.selectedTopicId}}
- @autoFocus={{this.existingTopic}}
/>
{{#if this.selectedTopicId}}
@@ -161,11 +161,13 @@
{{#if this.canSplitTopic}}
{{#if this.newTopic}}
- <p>{{html-safe
+ <p>
+ {{html-safe
(i18n
"topic.split_topic.instructions" [email protected]
)
- }}</p>
+ }}
+ </p>
<form class="split-new-topic-form">
<div class="control-group">
<label>{{i18n "topic.split_topic.topic_name"}}</label>