Skip to content
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

Cannot get search events to fire #872

Closed
trbroyles1 opened this issue Jun 24, 2020 · 1 comment
Closed

Cannot get search events to fire #872

trbroyles1 opened this issue Jun 24, 2020 · 1 comment
Labels

Comments

@trbroyles1
Copy link
Contributor

Describe the bug
Have spent about the last 3 hours banging my head against the wall on this -- really hoping that I'm missing something terribly obvious.

I cannot, for the life of me, get the search event to fire on any type of input that I attach choices.js to. I've tried in FF 77 and Chrome 83. I've tried with Polyfills (even though I shouldn't need them) and without Polyfills. I've tried doing it via JS I have that runs when the page loads, and I've tried setting Choices up directly via the browser console. I've tried with input types text, select-single and select-multiple. The most basic test I've been able to conceive is outlined below...

To Reproduce
Steps to reproduce the behavior:

  1. Establish a basic web page with text, select-single or select-multiple control with id "person_first_name" on it.
  2. Open the browser console.
  3. Run following steps - built by following examples from Github readme.md...
var elmnt = document.getElementById('person_first_name');

var example = new Choices(elmnt, {choices: [{value: 0, label: "Option"}], addItems: true, searchEnabled: true, searchChoices: true});

elmnt.addEventListener(
  'search',
  function(event) {
    alert("search fired!");
    console.log(event.detail.id);
    console.log(event.detail.value);
    console.log(event.detail.label);
    console.log(event.detail.customProperties);
    console.log(event.detail.groupValue);
  },
  false,
);
  1. Enter text in the person_first_name textbox

>> link to a basic fiddle demonstrating my simple test: https://jsfiddle.net/w4o2ptx9/1/ <<

Expected behavior

  1. Popup saying "search fired!"
  2. Console logging of search events being fired.

Screenshots
image

Desktop (please complete the following information):

  • OS: Lubuntu 20.04
  • Browser Chrome 83, FF 77
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
None, I believe the issue fully described above.

@trbroyles1
Copy link
Contributor Author

Sometimes coming back a day later really does help. I was not using the correct input type. Proposing PR #873 with an amelioration to Readme.md to help others who may encounter similar issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant