DEV: Prevent close of summary from outside clicks (#808)

Often it is helpful to have the summary box open while composing a reply to the topic. However, the summary box currently gets closed each time you click outside the box. In this PR we add `closeOnClickOutside: false` attribute to the `DMenu` options for summary box to prevent that from occurring.
This commit is contained in:
Keegan George 2024-09-18 10:36:42 -07:00 committed by GitHub
parent e666266473
commit 95f80325e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -196,6 +196,7 @@ export default class AiSummaryBox extends Component {
@title={{i18n "summary.buttons.generate"}} @title={{i18n "summary.buttons.generate"}}
@icon="discourse-sparkles" @icon="discourse-sparkles"
@triggerClass="ai-topic-summarization" @triggerClass="ai-topic-summarization"
@closeOnClickOutside={{false}}
> >
<:content> <:content>
<div class="ai-summary-container"> <div class="ai-summary-container">

View File

@ -1,5 +1,5 @@
import { click, visit } from "@ember/test-helpers"; import { click, visit } from "@ember/test-helpers";
import { skip } from "qunit"; import { skip, test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic"; import topicFixtures from "discourse/tests/fixtures/topic";
import { import {
acceptance, acceptance,
@ -125,7 +125,7 @@ acceptance("Topic - Summary - Anon", function (needs) {
}); });
}); });
skip("displays cached summary immediately", async function (assert) { test("displays cached summary immediately", async function (assert) {
await visit("/t/-/1"); await visit("/t/-/1");
await click(".ai-topic-summarization"); await click(".ai-topic-summarization");
@ -138,4 +138,11 @@ acceptance("Topic - Summary - Anon", function (needs) {
.dom(".ai-summary-box .summarized-on") .dom(".ai-summary-box .summarized-on")
.exists("summary metadata exists"); .exists("summary metadata exists");
}); });
test("clicking outside of summary should not close the summary box", async function (assert) {
await visit("/t/-/1");
await click(".ai-topic-summarization");
await click("#main-outlet-wrapper");
assert.dom(".ai-summary-box").exists();
});
}); });