fix: prevent CMD/CTRL+Arrow scroll from overriding textarea cursor movement (#5053)
prevent CMD/CTRL+Arrow scroll from overriding textarea cursor movement Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
parent
b13dd820cc
commit
87b81f9d09
@ -24,6 +24,10 @@ export default function useChatContainerQuickScroll() {
|
|||||||
if (!modifierPressed || !chatHistoryRef.current) return;
|
if (!modifierPressed || !chatHistoryRef.current) return;
|
||||||
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
||||||
|
|
||||||
|
// Don't hijack cursor movement when a text input is focused
|
||||||
|
const tag = document.activeElement?.tagName;
|
||||||
|
if (tag === "TEXTAREA" || tag === "INPUT") return;
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "ArrowUp":
|
case "ArrowUp":
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user