Fix keyboard search when left pane is narrow
This PR fixes Cmd+f/Ctrl+f functionality in the left pane. Using a keyboard to search across all conversations should now automatically change the left pane width to accommodate the search input component. Resolves: #6281
This commit is contained in:
parent
3d735acdec
commit
0100866d0a
7 changed files with 99 additions and 23 deletions
|
@ -57,6 +57,7 @@ export type MessageSearchResultLookupType = ReadonlyDeep<{
|
|||
export type SearchStateType = ReadonlyDeep<{
|
||||
startSearchCounter: number;
|
||||
searchConversationId?: string;
|
||||
globalSearch?: boolean;
|
||||
contactIds: Array<string>;
|
||||
conversationIds: Array<string>;
|
||||
query: string;
|
||||
|
@ -94,7 +95,7 @@ type UpdateSearchTermActionType = ReadonlyDeep<{
|
|||
}>;
|
||||
type StartSearchActionType = ReadonlyDeep<{
|
||||
type: 'SEARCH_START';
|
||||
payload: null;
|
||||
payload: { globalSearch: boolean };
|
||||
}>;
|
||||
type ClearSearchActionType = ReadonlyDeep<{
|
||||
type: 'SEARCH_CLEAR';
|
||||
|
@ -137,7 +138,7 @@ export const actions = {
|
|||
function startSearch(): StartSearchActionType {
|
||||
return {
|
||||
type: 'SEARCH_START',
|
||||
payload: null,
|
||||
payload: { globalSearch: true },
|
||||
};
|
||||
}
|
||||
function clearSearch(): ClearSearchActionType {
|
||||
|
@ -341,6 +342,7 @@ export function reducer(
|
|||
return {
|
||||
...state,
|
||||
searchConversationId: undefined,
|
||||
globalSearch: true,
|
||||
startSearchCounter: state.startSearchCounter + 1,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -54,6 +54,23 @@ export const getIsSearchingInAConversation = createSelector(
|
|||
Boolean
|
||||
);
|
||||
|
||||
export const getGlobalSearchValue = createSelector(
|
||||
getSearch,
|
||||
(state: SearchStateType): boolean | undefined => state.globalSearch
|
||||
);
|
||||
|
||||
export const getIsSearchingGlobally = createSelector(
|
||||
getGlobalSearchValue,
|
||||
Boolean
|
||||
);
|
||||
|
||||
export const getIsSearching = createSelector(
|
||||
getIsSearchingInAConversation,
|
||||
getIsSearchingGlobally,
|
||||
(isSearchingInAConversation, isSearchingGlobally): boolean =>
|
||||
isSearchingInAConversation || isSearchingGlobally
|
||||
);
|
||||
|
||||
export const getSearchConversation = createSelector(
|
||||
getSearchConversationId,
|
||||
getConversationLookup,
|
||||
|
|
|
@ -16,7 +16,7 @@ import { isDone as isRegistrationDone } from '../../util/registration';
|
|||
|
||||
import { ComposerStep, OneTimeModalState } from '../ducks/conversationsEnums';
|
||||
import {
|
||||
getIsSearchingInAConversation,
|
||||
getIsSearching,
|
||||
getQuery,
|
||||
getSearchConversation,
|
||||
getSearchResults,
|
||||
|
@ -152,7 +152,7 @@ const getModeSpecificProps = (
|
|||
}
|
||||
return {
|
||||
mode: LeftPaneMode.Inbox,
|
||||
isAboutToSearchInAConversation: getIsSearchingInAConversation(state),
|
||||
isAboutToSearch: getIsSearching(state),
|
||||
searchConversation: getSearchConversation(state),
|
||||
searchDisabled: state.network.challengeStatus !== 'idle',
|
||||
searchTerm: getQuery(state),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue