Merge pull request #518 from kubet/fix/pointer-native-event

Fix/pointer native event
This commit is contained in:
kubet 2025-05-26 19:52:34 +02:00 committed by GitHub
commit 606bff01f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 92 additions and 75 deletions

View File

@ -462,8 +462,7 @@ export function NavAgents() {
<div className="relative"> <div className="relative">
<SidebarMenuButton <SidebarMenuButton
asChild asChild
className={`relative ${ className={`relative ${isActive
isActive
? 'bg-accent text-accent-foreground font-medium' ? 'bg-accent text-accent-foreground font-medium'
: isSelected : isSelected
? 'bg-primary/10' ? 'bg-primary/10'
@ -485,23 +484,20 @@ export function NavAgents() {
<> <>
{/* MessagesSquare icon - hidden on hover if not selected */} {/* MessagesSquare icon - hidden on hover if not selected */}
<MessagesSquare <MessagesSquare
className={`h-4 w-4 transition-opacity duration-150 ${ className={`h-4 w-4 transition-opacity duration-150 ${isSelected ? 'opacity-0' : 'opacity-100 group-hover/icon:opacity-0'
isSelected ? 'opacity-0' : 'opacity-100 group-hover/icon:opacity-0'
}`} }`}
/> />
{/* Checkbox - appears on hover or when selected */} {/* Checkbox - appears on hover or when selected */}
<div <div
className={`absolute inset-0 flex items-center justify-center transition-opacity duration-150 ${ className={`absolute inset-0 flex items-center justify-center transition-opacity duration-150 ${isSelected
isSelected
? 'opacity-100' ? 'opacity-100'
: 'opacity-0 group-hover/icon:opacity-100' : 'opacity-0 group-hover/icon:opacity-100'
}`} }`}
onClick={(e) => toggleThreadSelection(thread.threadId, e)} onClick={(e) => toggleThreadSelection(thread.threadId, e)}
> >
<div <div
className={`h-4 w-4 border rounded cursor-pointer hover:bg-muted/50 transition-colors flex items-center justify-center ${ className={`h-4 w-4 border rounded cursor-pointer hover:bg-muted/50 transition-colors flex items-center justify-center ${isSelected
isSelected
? 'bg-primary border-primary' ? 'bg-primary border-primary'
: 'border-muted-foreground/30 bg-background' : 'border-muted-foreground/30 bg-background'
}`} }`}
@ -520,7 +516,14 @@ export function NavAgents() {
{state !== 'collapsed' && !isSelected && ( {state !== 'collapsed' && !isSelected && (
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<SidebarMenuAction showOnHover className="group-hover:opacity-100"> <SidebarMenuAction
showOnHover
className="group-hover:opacity-100"
onClick={() => {
// Ensure pointer events are enabled when dropdown opens
document.body.style.pointerEvents = 'auto';
}}
>
<MoreHorizontal /> <MoreHorizontal />
<span className="sr-only">More</span> <span className="sr-only">More</span>
</SidebarMenuAction> </SidebarMenuAction>

View File

@ -29,6 +29,13 @@ export function ShareModal({ isOpen, onClose, threadId, projectId }: ShareModalP
const [isChecking, setIsChecking] = useState(false); const [isChecking, setIsChecking] = useState(false);
const [isCopying, setIsCopying] = useState(false); const [isCopying, setIsCopying] = useState(false);
// Reset pointer events when modal opens
useEffect(() => {
if (isOpen) {
document.body.style.pointerEvents = 'auto';
}
}, [isOpen]);
const updateThreadMutation = useUpdateThreadMutation(); const updateThreadMutation = useUpdateThreadMutation();
useEffect(() => { useEffect(() => {

View File

@ -1,6 +1,6 @@
'use client'; 'use client';
import React from 'react'; import React, { useEffect } from 'react';
import { Loader2 } from 'lucide-react'; import { Loader2 } from 'lucide-react';
import { import {
@ -32,6 +32,13 @@ export function DeleteConfirmationDialog({
threadName, threadName,
isDeleting, isDeleting,
}: DeleteConfirmationDialogProps) { }: DeleteConfirmationDialogProps) {
// Reset pointer events when dialog opens
useEffect(() => {
if (isOpen) {
document.body.style.pointerEvents = 'auto';
}
}, [isOpen]);
return ( return (
<AlertDialog open={isOpen} onOpenChange={onClose}> <AlertDialog open={isOpen} onOpenChange={onClose}>
<AlertDialogContent> <AlertDialogContent>

View File

@ -96,7 +96,7 @@ export const MessageInput = forwardRef<HTMLTextAreaElement, MessageInputProps>(
}, [value, ref]); }, [value, ref]);
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => { const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) { if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault(); e.preventDefault();
if ( if (
(value.trim() || uploadedFiles.length > 0) && (value.trim() || uploadedFiles.length > 0) &&