From 44031656c6083ad645d83e19a88b5fe19cb5c714 Mon Sep 17 00:00:00 2001 From: Darren Semotiuk <106487066+DarrenSem@users.noreply.github.com> Date: Sun, 30 Jul 2023 10:28:13 -0600 Subject: [PATCH] Fixes #3. Remove LAST place now sets focus to end --- index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 0be3f9c..c2f2d62 100644 --- a/index.html +++ b/index.html @@ -267,7 +267,12 @@ const removePlace = (index) => { const newPlaces = [...places]; newPlaces.splice(index, 1); - focusIndex(index, FOCUS_DELAY_SECONDARY); + focusIndex( + index < newPlaces.length + ? index + : newPlaces.length - 1, + FOCUS_DELAY_SECONDARY + ); setPlaces(newPlaces); };