mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
UX: disables composer auto focus on drawer (#20751)
This behavior was interfering with topics shortcuts.
This commit is contained in:
parent
d5c7b9f8df
commit
53cadac4b8
@ -1245,6 +1245,10 @@ export default class ChatLivePane extends Component {
|
|||||||
|
|
||||||
@bind
|
@bind
|
||||||
_autoFocus(event) {
|
_autoFocus(event) {
|
||||||
|
if (this.chatStateManager.isDrawerActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { key, metaKey, ctrlKey, code, target } = event;
|
const { key, metaKey, ctrlKey, code, target } = event;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -42,6 +42,17 @@ RSpec.describe "Shortcuts | drawer", type: :system, js: true do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when pressing a letter" do
|
||||||
|
it "doesn’t intercept the event" do
|
||||||
|
drawer.open_channel(channel_1)
|
||||||
|
find(".header-sidebar-toggle").click # simple way to ensure composer is not focused
|
||||||
|
|
||||||
|
page.send_keys("e")
|
||||||
|
|
||||||
|
expect(find(".chat-composer-input").value).to eq("")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when using Up/Down arrows" do
|
context "when using Up/Down arrows" do
|
||||||
it "navigates through the channels" do
|
it "navigates through the channels" do
|
||||||
drawer.open_channel(channel_1)
|
drawer.open_channel(channel_1)
|
||||||
|
25
plugins/chat/spec/system/shortcuts/full_page_spec.rb
Normal file
25
plugins/chat/spec/system/shortcuts/full_page_spec.rb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
RSpec.describe "Shortcuts | full page", type: :system, js: true do
|
||||||
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||||
|
fab!(:current_user) { Fabricate(:user) }
|
||||||
|
|
||||||
|
let(:chat) { PageObjects::Pages::Chat.new }
|
||||||
|
|
||||||
|
before do
|
||||||
|
chat_system_bootstrap
|
||||||
|
channel_1.add(current_user)
|
||||||
|
sign_in(current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when pressing a letter" do
|
||||||
|
it "intercepts the event and propagates it to the composer" do
|
||||||
|
chat.visit_channel(channel_1)
|
||||||
|
find(".header-sidebar-toggle").click # simple way to ensure composer is not focused
|
||||||
|
|
||||||
|
page.send_keys("e")
|
||||||
|
|
||||||
|
expect(find(".chat-composer-input").value).to eq("e")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user