mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-15 08:48:15 +00:00
Fix nested buttons in search popout in web UI (#34871)
This commit is contained in:
parent
9c80b16401
commit
c77158c8b7
|
@ -121,10 +121,15 @@ export const clickSearchResult = createAppAsyncThunk(
|
||||||
|
|
||||||
export const forgetSearchResult = createAppAsyncThunk(
|
export const forgetSearchResult = createAppAsyncThunk(
|
||||||
'search/forgetResult',
|
'search/forgetResult',
|
||||||
(q: string, { dispatch, getState }) => {
|
(
|
||||||
|
{ q, type }: { q: string; type?: RecentSearchType },
|
||||||
|
{ dispatch, getState },
|
||||||
|
) => {
|
||||||
const previous = getState().search.recent;
|
const previous = getState().search.recent;
|
||||||
const me = getState().meta.get('me') as string;
|
const me = getState().meta.get('me') as string;
|
||||||
const current = previous.filter((result) => result.q !== q);
|
const current = previous.filter(
|
||||||
|
(result) => result.q !== q || result.type !== type,
|
||||||
|
);
|
||||||
|
|
||||||
searchHistory.set(me, current);
|
searchHistory.set(me, current);
|
||||||
dispatch(updateSearchHistory(current));
|
dispatch(updateSearchHistory(current));
|
||||||
|
|
|
@ -221,7 +221,7 @@ export const Search: React.FC<{
|
||||||
},
|
},
|
||||||
forget: (e) => {
|
forget: (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
void dispatch(forgetSearchResult(search.q));
|
void dispatch(forgetSearchResult(search));
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -497,8 +497,10 @@ export const Search: React.FC<{
|
||||||
<div className='search__popout__menu'>
|
<div className='search__popout__menu'>
|
||||||
{recentOptions.length > 0 ? (
|
{recentOptions.length > 0 ? (
|
||||||
recentOptions.map(({ label, key, action, forget }, i) => (
|
recentOptions.map(({ label, key, action, forget }, i) => (
|
||||||
<button
|
<div
|
||||||
key={key}
|
key={key}
|
||||||
|
tabIndex={0}
|
||||||
|
role='button'
|
||||||
onMouseDown={action}
|
onMouseDown={action}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'search__popout__menu__item search__popout__menu__item--flex',
|
'search__popout__menu__item search__popout__menu__item--flex',
|
||||||
|
@ -509,7 +511,7 @@ export const Search: React.FC<{
|
||||||
<button className='icon-button' onMouseDown={forget}>
|
<button className='icon-button' onMouseDown={forget}>
|
||||||
<Icon id='times' icon={CloseIcon} />
|
<Icon id='times' icon={CloseIcon} />
|
||||||
</button>
|
</button>
|
||||||
</button>
|
</div>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<div className='search__popout__menu__message'>
|
<div className='search__popout__menu__message'>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user