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')} className={buildClassName('composer-action-button', isBotKeyboardOpen && 'activated')}
round round
color="translucent" color="translucent"
noClickActivation
onActivate={openBotKeyboard} onActivate={openBotKeyboard}
ariaLabel={lang('AriaComposerBotKeyboard')} ariaLabel={lang('AriaComposerBotKeyboard')}
> >

View File

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

View File

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