Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
AutocompletePicker: Setting the value to `undefined` doesn't work as expected #435
When using an autocomplete picker, the documentation states that you can use
The value is set to
The issue looks to be caused by a default value for the filter search term: https://github.com/ocadotechnology/hexagonjs/blob/master/modules/autocomplete-feed/main/index.coffee#L52
Changing the logic to explicitly handle undefined separately from regular items would resolve this
Steps to Reproduce
const div = hx.select('body').append('div') const ap = new hx.AutocompletePicker(div, ['a','b','c']) console.log(ap.value()) // undefined ap.value('b') // undefined console.log(ap.value()) // 'b' ap.value(undefined) console.log(ap.value()) // 'a'
Interestingly, setting the value to a defined value that is not in the list seems to un-set the value in the expected way.