knockout / knockout

Knockout makes it easier to create rich, responsive UIs with JavaScript
http://knockoutjs.com/
Other
10.43k stars 1.52k forks source link

bug in example hasfocus-binding.html #2581

Open johngrabner opened 2 years ago

johngrabner commented 2 years ago

https://knockoutjs.com/documentation/hasfocus-binding.html

click on "Bert Bertington" to gain focus, then clear the entry ie: no text in input field

Now input can never again gain focus.

fastfasterfastest commented 2 years ago

Just to be clear, it is not a problem w/ the hasFocus binding - it's merely a suboptimal example. And there are several different approaches to avoid this in a real world situation.

In this particular example, one way would be to change the text binding on the <b> element to: text: name() || '[ none ]'