Skip to content

Commit

Permalink
fix: try fix close
Browse files Browse the repository at this point in the history
  • Loading branch information
aeksandla committed Feb 15, 2024
1 parent 5d36449 commit e000e8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const renderSwitcher: RenderSwitcherType =
/>
);

export const renderFilter: SelectProps['renderFilter'] = ({value, onChange, onKeyDown, ref}) => (
export const renderFilter: SelectProps['renderFilter'] = ({value, onChange, onKeyDown}) => (
<TextInput
controlProps={{size: 1}}
value={value}
Expand All @@ -49,7 +49,6 @@ export const renderFilter: SelectProps['renderFilter'] = ({value, onChange, onKe
onUpdate={onChange}
onKeyDown={onKeyDown}
className={b('popup-filter')}
ref={ref}
/>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {LegacyRef, useMemo} from 'react';
import React, {LegacyRef, MouseEvent, useMemo} from 'react';

import {Icon, SelectProps} from '@gravity-ui/uikit';

Expand Down Expand Up @@ -42,14 +42,19 @@ export const CustomSwitcher = ({
}, [defaultLabel, initial, list]);
const hasCounter = itemsNames.length > 1;

const handleClick = (e: MouseEvent<HTMLDivElement>) => {
e.currentTarget.focus();
onClick?.();
};

return (
<button
className={b('custom-switcher')}
ref={controlRef as LegacyRef<HTMLButtonElement>}
onKeyDown={onKeyDown}
aria-expanded={open}
>
<div onClick={onClick} className={b('custom-switcher-element', {overlay: true})} />
<div onClick={handleClick} className={b('custom-switcher-element', {overlay: true})} />
<div className={b('custom-switcher-element', {content: true})}>
{itemsNames?.join(', ')}
</div>
Expand Down

0 comments on commit e000e8e

Please sign in to comment.