From c07cdcae63b745feb4e5efe50abfeeee131acdfa Mon Sep 17 00:00:00 2001 From: Melloware Date: Sun, 4 Feb 2024 12:33:03 -0500 Subject: [PATCH] Fix #5849: Splitter improve keyboard repeat behavior (#5884) --- components/lib/splitter/Splitter.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/lib/splitter/Splitter.js b/components/lib/splitter/Splitter.js index b9fb23a24f..349d52f5ac 100644 --- a/components/lib/splitter/Splitter.js +++ b/components/lib/splitter/Splitter.js @@ -274,7 +274,7 @@ export const Splitter = React.memo( } case 'Enter': { - if (prevSize.current > 99) { + if (prevSize.current > 100 - (minSize || 5)) { resizePanel(index, minSize, 100); } else { resizePanel(index, 100, minSize); @@ -312,15 +312,17 @@ export const Splitter = React.memo( }; const setTimer = (event, index, step) => { - clearTimer(); - timer.current = setTimeout(() => { - repeat(event, index, step); - }, 40); + if (!timer.current) { + timer.current = setInterval(() => { + repeat(event, index, step); + }, 40); + } }; const clearTimer = () => { if (timer.current) { - clearTimeout(timer.current); + clearInterval(timer.current); + timer.current = null; } };