Skip to content

Commit cb0f922

Browse files
authored
🗨️ refactor: Open New Tab for Ctrl+Click or Button Combo in NewChat (danny-avila#1484)
1 parent 9e34c1c commit cb0f922

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

client/src/components/Nav/NewChat.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ export default function NewChat({ toggleNav }: { toggleNav: () => void }) {
66
const navigate = useOriginNavigate();
77
const localize = useLocalize();
88

9-
const clickHandler = () => {
10-
newConvo();
11-
newConversation();
12-
navigate('new');
13-
toggleNav();
9+
const clickHandler = (event: React.MouseEvent<HTMLAnchorElement>) => {
10+
if (event.button === 0 && !event.ctrlKey) {
11+
event.preventDefault();
12+
newConvo();
13+
newConversation();
14+
navigate('new');
15+
toggleNav();
16+
}
1417
};
1518

1619
return (
1720
<a
21+
href="/"
1822
data-testid="nav-new-chat-button"
1923
onClick={clickHandler}
2024
className="flex h-11 flex-shrink-0 flex-grow cursor-pointer items-center gap-3 rounded-md border border-white/20 px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-500/10"

0 commit comments

Comments
 (0)