A platform for community discussion. Free, open, simple.
UX: Remove Ctrl+F search shortcut (#32281)
Martin Brennan735bef9ea0d4
diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.jsindex e4683e4c5a0..6f40679a262 100644--- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js+++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js@@ -60,8 +60,6 @@ const DEFAULT_BINDINGS = {b: { handler: "toggleBookmark" },c: { handler: "createTopic" },"shift+c": { handler: "focusComposer" },- "ctrl+f": { handler: "showPageSearch", anonymous: true },- "command+f": { handler: "showPageSearch", anonymous: true },"command+left": { handler: "webviewKeyboardBack", anonymous: true },"command+[": { handler: "webviewKeyboardBack", anonymous: true },"command+right": { handler: "webviewKeyboardForward", anonymous: true },diff --git a/app/assets/javascripts/float-kit/addon/components/d-default-toast.gjs b/app/assets/javascripts/float-kit/addon/components/d-default-toast.gjsindex 1c6f1da0ed5..f821b887bef 100644--- a/app/assets/javascripts/float-kit/addon/components/d-default-toast.gjs+++ b/app/assets/javascripts/float-kit/addon/components/d-default-toast.gjs@@ -1,5 +1,6 @@import { concat, fn, hash } from "@ember/helper";import didInsert from "@ember/render-modifiers/modifiers/did-insert";+import { htmlSafe } from "@ember/template";import { or } from "truth-helpers";import DButton from "discourse/components/d-button";import concatClass from "discourse/helpers/concat-class";@@ -33,7 +34,11 @@ const DDefaultToast = <template>{{/if}}{{#if @data.message}}<div class="fk-d-default-toast__message">- {{@data.message}}+ {{#if @data.isHtmlMessage}}+ {{htmlSafe @data.message}}+ {{else}}+ {{@data.message}}+ {{/if}}</div>{{/if}}</div>diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 56d33078924..bdc8780e184 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -2203,6 +2203,7 @@ en:user_tips:button: "Got it!"skip: "Skip tips"+ dont_show_again: "Don't show this again"first_notification:title: "Your first notification!"@@ -4564,6 +4565,7 @@ en:shortcut_delimiter_newline: "%{shortcut1}<br>%{shortcut2}"title: "Keyboard Shortcuts"short_title: "Shortcuts"+ search_ctrl_f_tip: "To search across this entire forum, press <kbd>/</kbd>"jump_to:title: "Jump To"home: "%{shortcut} Home"diff --git a/spec/system/search_shortcut_variation_spec.rb b/spec/system/search_shortcut_variation_spec.rbindex f5995a99d41..1b5bb827821 100644--- a/spec/system/search_shortcut_variation_spec.rb+++ b/spec/system/search_shortcut_variation_spec.rb@@ -24,29 +24,6 @@ describe "Search | Shortcuts for variations of search input", type: :system doexpect(search_page).to have_no_search_menu_visibleend- it "displays and focuses welcome banner search when Ctrl+F is pressed and hides it when Escape is pressed" do- visit("/")- expect(welcome_banner).to be_visible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("welcome-banner-search-input")- page.send_keys(:escape)- expect(search_page).to have_no_search_menu_visible- end-- it "displays and focuses welcome banner search when Ctrl+F is pressed and blurs it when Ctrl+F is pressed" do- visit("/")- expect(welcome_banner).to be_visible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("welcome-banner-search-input")- # NOTE: This does not work as expected because pressing Ctrl+F in the browser does- # not change the document acive element, leaving it here as a reminder to manually test- # this behavior.- # search_page.browser_search_shortcut- # expect(current_active_element[:id]).to eq(nil)- end-context "when welcome banner is not in the viewport" dobefore dovisit("/")@@ -61,27 +38,6 @@ describe "Search | Shortcuts for variations of search input", type: :system dopage.send_keys(:escape)expect(search_page).to have_no_search_menu_visibleend-- it "displays and focuses header search when Ctrl+F is pressed and hides it when Escape is pressed" do- expect(welcome_banner).to be_invisible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("header-search-input")- page.send_keys(:escape)- expect(search_page).to have_no_search_menu_visible- end-- it "displays and focuses welcome banner search when Ctrl+F is pressed and blurs it when Ctrl+F is pressed" do- expect(welcome_banner).to be_invisible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("header-search-input")- # NOTE: This does not work as expected because pressing Ctrl+F in the browser does- # not change the document acive element, leaving it here as a reminder to manually test- # this behavior.- # search_page.browser_search_shortcut- # expect(current_active_element[:id]).to eq(nil)- endendend@@ -97,16 +53,6 @@ describe "Search | Shortcuts for variations of search input", type: :system dopage.send_keys(:escape)expect(search_page).to have_no_search_menu_visibleend-- it "displays and focuses header search when Ctrl+F is pressed and hides it when Escape is pressed" do- visit("/")- expect(welcome_banner).to be_hidden- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("header-search-input")- page.send_keys(:escape)- expect(search_page).to have_no_search_menu_visible- endendend@@ -126,30 +72,6 @@ describe "Search | Shortcuts for variations of search input", type: :system doexpect(search_page).to have_no_search_menu_visibleend- it "displays and focuses welcome banner search when Ctrl+F is pressed and hides it when Escape is pressed" do- visit("/")- expect(welcome_banner).to be_visible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("welcome-banner-search-input")- page.send_keys(:escape)- expect(search_page).to have_no_search_menu_visible- end-- it "displays and focuses welcome banner search when Ctrl+F is pressed and blurs it when Ctrl+F is pressed" do- visit("/")- expect(welcome_banner).to be_visible- search_page.browser_search_shortcut- expect(search_page).to have_search_menu- expect(current_active_element[:id]).to eq("welcome-banner-search-input")-- # NOTE: This does not work as expected because pressing Ctrl+F in the browser does- # not change the document acive element, leaving it here as a reminder to manually test- # this behavior.- # search_page.browser_search_shortcut- # expect(current_active_element[:id]).to eq(nil)- end-context "when welcome banner is not in the viewport" dobefore dovisit("/")@@ -186,16 +108,13 @@ describe "Search | Shortcuts for variations of search input", type: :system dofab!(:topic)fab!(:posts) { Fabricate.times(21, :post, topic: topic) }- it "opens search on first press of Ctrl+F, and closes on the second" do+ it "opens search on first press of /, and closes when Escape is pressed" dovisit "/t/#{topic.slug}/#{topic.id}"- search_page.browser_search_shortcut- expect(search_page).to have_search_menu_visible+ page.send_keys("/")+ expect(search_page).to have_search_menuexpect(current_active_element[:id]).to eq("icon-search-input")- # NOTE: This does not work as expected because pressing Ctrl+F in the browser does- # not change the document acive element, leaving it here as a reminder to manually test- # this behavior.- # search_page.browser_search_shortcut- # expect(current_active_element[:id]).to eq(nil)+ page.send_keys(:escape)+ expect(search_page).to have_no_search_menu_visibleendendend