why I can’t pass my input in foo function

foo() {
	read -r -p "delete $name (default is no) [y/n]?  " choice
	choice="${choice:-n}"
	echo "\$choice: $choice"
}

printf "%s\n" "foo" "bar" "baz" "eggs" "spam" | while read -r name; do
	foo

Expected result:

delete foo (default is no) [y/n]? USER_INPUT
$choice: USER_INPUT
delete bar (default is no) [y/n]? USER_INPUT
$choice: USER_INPUT
# truncated

Actual output:

$choice: bar
$choice: eggs
$choice: n

[!NOTE] Actual output produced without user interaction