-
Notifications
You must be signed in to change notification settings - Fork 628
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
[v11] main
branch: Regression in "no choices text" when clearing search field
#1191
Comments
I think that there are other regression with the search functionality, related to how |
Thanks for identifying this, it looks like this is going to need more work on when |
I've added an e2e test which reproduces the issue, but it will be in a day or so before I can dig into the notice display logic for this |
No problems, thanks again for your support. I'm not a JavaScript developer and I'm not familiar with choices.js internals so it would require more time on my side to try and submit a PR. |
PR #1192 should work better, it cleaned up some possible issues with no results vs no choices. I haven't had time to fully test it and see if any of the other end-to-end tests need updating to verify the behavior is working properly. |
@tagliala |
Hi @Xon, I've tested main, works almost like v10, there one more thing with a slightly more complex scenario https://jsfiddle.net/tagliala/rx8mtbz6/40/
ExpectedSee "No Choices" ActualEmpty ![]() const select = document.querySelector("#choices");
const choices = new Choices(select, {
noChoicesText: 'No Choices!'
});
choices.passedElement.element.addEventListener(
'search',
function(e) {
const query = e.detail.value
if (query.length < 2) {
choices.clearChoices()
return
}
let result = []
if (query.slice(0, 2) === 'fo') {
result = [{
value: 'found',
label: 'Found'
}]
}
choices.setChoices(
result,
'value',
'label',
true
)
}
) |
This is encountering a few issues:
I'm not sure what the best solution is for using choices as a autocomplete widget with these constrains, I'll need to consider possible solutions. |
I've adjusted There are still some minor behavior differences (how selected items/choices show up), but I think it is acceptable without major changes. |
|
Thanks, I've tested the main branch and it now works better I've switched to |
Describe the bug
Hello, this is a follow up of #1185
To Reproduce
Steps to reproduce the behavior:
noChoicesText
does not AppearOn v10.2, the text appears: https://jsfiddle.net/tagliala/rx8mtbz6/9
Expected behavior
See "Hello World"
Screenshots
v10
v11
Choices version and bundle
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: