diff --git a/src/theme/SearchBar/DocSearch.js b/src/theme/SearchBar/DocSearch.js index f608bb0..8ab268b 100644 --- a/src/theme/SearchBar/DocSearch.js +++ b/src/theme/SearchBar/DocSearch.js @@ -86,10 +86,9 @@ class DocSearch { DocSearch.bindSearchBoxEvent(); } - - // Ctrl + K should focus the search bar, emulating the Algolia search UI + // Ctrl/Cmd + K should focus the search bar, emulating the Algolia search UI document.addEventListener('keydown', (e) => { - if (e.ctrlKey && e.key == 'k') { + if ((e.ctrlKey || e.metaKey) && e.key == 'k') { this.input.focus(); // By default, using Ctrl + K in Chrome will open the location bar, so disable this diff --git a/src/theme/SearchBar/index.jsx b/src/theme/SearchBar/index.jsx index fc4ac9b..9f3379f 100644 --- a/src/theme/SearchBar/index.jsx +++ b/src/theme/SearchBar/index.jsx @@ -96,8 +96,11 @@ const Search = props => { [props.isSearchBarExpanded] ); + let placeholder if (isBrowser) { loadAlgolia(); + placeholder = window.navigator.platform.startsWith("Mac") ? + 'Search ⌘+K' : 'Search Ctrl+K' } return ( @@ -115,7 +118,7 @@ const Search = props => {