New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutocompletePicker: Setting the value to `undefined` doesn't work as expected #435

c-frater opened this Issue Apr 12, 2018 · 0 comments


None yet
1 participant
Copy link

c-frater commented Apr 12, 2018


When using an autocomplete picker, the documentation states that you can use .value(undefined) to reset the value and show the Choose a value... text. In practice, it shows instead the first item from the list of values that it has

Expected Behavior

When calling .value(undefined) the

Actual Behavior

The value is set to .items()[0] (the first item in the list of AutocompletePicker items)

Possible Fix

The issue looks to be caused by a default value for the filter search term:

Changing the logic to explicitly handle undefined separately from regular items would resolve this

Steps to Reproduce

const div ='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'
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.
I.e. ap.value('123') would set the value to undefined

Your Environment

  • Hexagon Version: 1.14.0

@c-frater c-frater added the Bug label Apr 17, 2018

@c-frater c-frater modified the milestones: 2.0.0, Pre 2.0.0 Jul 3, 2018

@c-frater c-frater self-assigned this Jul 11, 2018

@c-frater c-frater added In Review and removed In Review labels Jul 24, 2018

@c-frater c-frater closed this Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment