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); };