mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 23:44:48 +08:00
UX: close thread panel with a single escape (#31426)
Before this commit we were requiring two escapes: - one to un-focus composer - one to close panel
This commit is contained in:
@ -73,13 +73,8 @@ export default class ChatComposerThread extends ChatComposer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isFocused) {
|
this.pane.close().then(() => {
|
||||||
event.stopPropagation();
|
this.channelComposer.focus();
|
||||||
this.composer.blur();
|
});
|
||||||
} else {
|
|
||||||
this.pane.close().then(() => {
|
|
||||||
this.channelComposer.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,19 +19,9 @@ RSpec.describe "Chat | composer | shortcuts | thread", type: :system do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "Escape" do
|
describe "Escape" do
|
||||||
context "when composer is focused" do
|
|
||||||
it "blurs the composer" do
|
|
||||||
chat_page.visit_thread(thread_1)
|
|
||||||
thread_page.composer.focus
|
|
||||||
thread_page.composer.cancel_shortcut
|
|
||||||
|
|
||||||
expect(side_panel_page).to have_open_thread
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it "closes the thread panel" do
|
it "closes the thread panel" do
|
||||||
chat_page.visit_thread(thread_1)
|
chat_page.visit_thread(thread_1)
|
||||||
thread_page.composer.cancel_shortcut # ensures we are not focused in the composer
|
|
||||||
page.send_keys(:escape)
|
page.send_keys(:escape)
|
||||||
|
|
||||||
expect(side_panel_page).to have_no_open_thread
|
expect(side_panel_page).to have_no_open_thread
|
||||||
|
Reference in New Issue
Block a user