Bot Menu: Disable click for bot command button (#6884)

This commit is contained in:
Alexander Zinchuk 2026-04-27 14:29:05 +02:00
parent 8753840f5c
commit 7c503dad68
3 changed files with 5 additions and 2 deletions

View File

@ -2461,6 +2461,7 @@ const Composer = ({
className={buildClassName('composer-action-button', isBotKeyboardOpen && 'activated')}
round
color="translucent"
noClickActivation
onActivate={openBotKeyboard}
ariaLabel={lang('AriaComposerBotKeyboard')}
>

View File

@ -66,6 +66,7 @@ const BotKeyboardMenu = ({
onCloseAnimationEnd={onClose}
onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}
onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}
noCloseOnBackdrop={!IS_TOUCH_ENV}
noCompact
>
<div className={buildClassName(styles.content, 'custom-scroll')}>

View File

@ -12,6 +12,7 @@ import Button from './Button';
type OwnProps = {
onActivate: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
noClickActivation?: boolean;
} & Omit<ButtonProps, (
'onClick' | 'onMouseDown' |
'onMouseEnter' | 'onMouseLeave' |
@ -22,7 +23,7 @@ const BUTTON_ACTIVATE_DELAY = 200;
let openTimeout: number | undefined;
let isFirstTimeActivation = true;
const ResponsiveHoverButton: FC<OwnProps> = ({ onActivate, ...buttonProps }) => {
const ResponsiveHoverButton: FC<OwnProps> = ({ onActivate, noClickActivation, ...buttonProps }) => {
const isMouseInsideRef = useRef(false);
const handleMouseEnter = useLastCallback((e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
@ -60,7 +61,7 @@ const ResponsiveHoverButton: FC<OwnProps> = ({ onActivate, ...buttonProps }) =>
{...buttonProps}
onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}
onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}
onClick={!IS_TOUCH_ENV ? onActivate : handleClick}
onClick={!IS_TOUCH_ENV ? (noClickActivation ? undefined : onActivate) : handleClick}
/>
);
};