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

Allow listening for events on SearchBox #2017

Closed
vvo opened this issue Mar 1, 2017 · 3 comments
Closed

Allow listening for events on SearchBox #2017

vvo opened this issue Mar 1, 2017 · 3 comments

Comments

@vvo
Copy link
Contributor

vvo commented Mar 1, 2017

The current SearchBox is not exposing any events while you may want to listen for them. The most obvious use case for now is being able to build an autocomplete menu reusing our SearchBox.

To solve this I propose to:

  • allow onSubmit and onReset, those should be set on the wrapping <form>. They are standard DOM events. onSubmit: when hitting enter or clicking the magnifying glass icon. onReset: when clicking the clear icon (which is a button type=reset
  • forward any other on* to the underlying input
@vvo vvo changed the title SearchBox events proposal Add events to SearchBox Mar 1, 2017
@vvo vvo changed the title Add events to SearchBox Allow listening for events on SearchBox Mar 1, 2017
@iam4x iam4x self-assigned this Mar 6, 2017
@vvo vvo closed this as completed in e267ab6 Mar 13, 2017
Haroenv added a commit that referenced this issue Mar 20, 2017
<a name="3.2.2-beta0"></a>
## [3.2.2-beta0](v3.2.1...v3.2.2-beta0) (2017-03-20)

### Bug Fixes

* **InfiniteHits:** provide translation key for `Load More` (#2048) ([6130bf2](6130bf2))
* **SearchBox:** better mobile behaviour by default ([ea968b3](ea968b3))
* **example:** link to instantsearch/react (#2007) ([5e674cd](5e674cd))
* **recipes:** react router v4 ([de673bf](de673bf))

### Features

* **SearchBox:** add role=search to the form (#2046) ([d1e90f3](d1e90f3))
* **SearchBox:** allow custom reset and submit components (#1991) ([cd303d7](cd303d7))
* **searchBox:** add event handling ([e267ab6](e267ab6)), closes [#2017](#2017)
@t0byman
Copy link

t0byman commented Apr 30, 2019

Can we get this in the regular JS / non-react version of instantsearch? I'm trying to make #1450 (comment) happen but that solution won't work. I'm guessing because there is already a preventDefault in instantsearch.js

@Haroenv
Copy link
Contributor

Haroenv commented May 1, 2019

Which events are you listening for? Could you list your use case you were thinking of in a new issue please so we don't forget about this in a closed issue @t0byman

@t0byman
Copy link

t0byman commented May 1, 2019

Thanks @Haroenv i created a new issue #3750

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

No branches or pull requests

5 participants