Skip to content

Commit

Permalink
Fix #5849: Splitter improve keyboard repeat behavior (#5884)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Feb 4, 2024
1 parent 8d56644 commit c07cdca
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions components/lib/splitter/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
};

Expand Down

0 comments on commit c07cdca

Please sign in to comment.