mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Select previous search input when clicking the search icon
Summary: Searching with the keyboard shortcut selected the previous search text in the search box, but using the Search icon did not. A user reported it as an inconvenience: having to manually delete the value before searching for a new one. Test Plan: Verified manually Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: georgegevoian Differential Revision: https://phab.getgrist.com/D3102
This commit is contained in:
parent
c5db65d1d2
commit
f0da3eb3b2
@ -124,8 +124,10 @@ const searchArrowBtnTooltipOptions: IHoverTipOptions = {
|
||||
export function searchBar(model: SearchModel, testId: TestId = noTestId) {
|
||||
let keepExpanded = false;
|
||||
|
||||
const focusAndSelect = () => { inputElem.focus(); inputElem.select(); };
|
||||
|
||||
const commandGroup = createGroup({
|
||||
find: () => { inputElem.focus(); inputElem.select(); },
|
||||
find: focusAndSelect,
|
||||
// On Mac, Firefox has a default behaviour witch causes to close the search bar on Cmd+g and
|
||||
// Cmd+shirt+G. Returning false is a Mousetrap convenience which prevents that.
|
||||
findNext: () => { model.findNext().catch(reportError); return false; },
|
||||
@ -164,7 +166,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
|
||||
cssHoverCircle(
|
||||
cssTopBarBtn('Search',
|
||||
testId('icon'),
|
||||
dom.on('click', () => inputElem.focus())
|
||||
dom.on('click', focusAndSelect),
|
||||
)
|
||||
),
|
||||
expandedSearch(
|
||||
|
Loading…
Reference in New Issue
Block a user