Autocomplete Issues

Product: PowerShell Universal
Version: 2.6.2

Three issues with autocomplete, I’m assuming all are bugs but wanted to make sure on the behavior of the first before submitting bug reports.

Sample code:

New-UDAutocomplete -OnLoadOptions {@('Test', 'Test (1234)', 'Test3', 'Test4') | Where-Object { $_ -match $Body } | ConvertTo-Json
    } -OnChange {
        Show-UDToast $Body
    }
  1. Choosing an item from the options doesn’t retain that value in the display unless completely typing the value. Choosing an item with the mouse or arrow keys causing the display to clear.

  2. The OnChange event doesn’t fire when completely filling in the a value, but only choosing the item with a mouse click will trigger the change event.

  3. Typing the open parenthesis will cause an error to display as show below for every item in the list. My autocomplete had 4000+ items and this caused numerous messages. The sample code only produces four. Additionally, typing the open parenthesis returns “No Options.”

image

image

image

  1. A bug but is resolved in 2.8
  2. I will open an issue for this. Can you use the keyboard and enter key to cause the OnChange to fire?
  3. A bug. I’ve never tried a parathesis before and maybe we have some weird regex stuff going on.

The ENTER key will not select item nor exit the field.

I must have missed the fix in the upgrade. Thanks!

2 Likes

I actually misspoke about when that was fixed and it is in 2.7.3.

1 Like

For 3, I realized this is a documentation issue. If you change -Match to -Like, it will work.

New-UDAutocomplete -OnLoadOptions {@('Test', 'Test (1234)', 'Test3', 'Test4') | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json
    } -OnChange {
        Show-UDToast $Body
    }

That works for pressing ENTER. Any chance we can get it to work if the user TABs out of the field?

BTW, updated to 2.7.3 and the value is now staying as expected for both mouse click and ENTER.
Also, the issue with the open parenthesis is now fixed when using LIKE instead of MATCH.

So items #1 and #3 are completely resolved and #2 partially.

1 Like

Sure. I can see about using tab.

1 Like