Skip to content

Commit

Permalink
Fix focus keyboard behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
jakst committed Dec 23, 2024
1 parent e383a66 commit 4203c95
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/app/src/components/ItemRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export function ItemRow(props: { item: ShoppingListItem }) {
const currentItemIndex = Array.from(inputs).indexOf(event.currentTarget)
if (currentItemIndex >= 0) {
const nextItem = inputs[currentItemIndex + 1]

// Focus instantly to keep keyboard open in proper browsers
nextItem.focus()
// Focus after delay to make it work in Safari...
setTimeout(() => nextItem.focus(), 100)
}
}
Expand Down

0 comments on commit 4203c95

Please sign in to comment.