-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Question: HeaderActionSearch #395
Comments
I wonder if it would be a nice to have to be able to bind a variable to the value too? |
I've ended up wrapping in a div and tracking the content in a variable. Feels a bit clunky - would this be the recommendation or any better suggestions? <script>
let searchString='';
function doSearch(e) {
if(e.which !== 13) return;
...
}
</script>
<div on:keypress="{doSearch}">
<HeaderActionSearch on:inputSearch="{e => searchString=e.detail.textInput}" />
</div> |
We'll take another pass at this component |
I guess it would make sense to ensure this and the standalone search were closely aligned? |
Yes, as much as possible they should be closely aligned in terms of forwarded/dispatched events (e.g., "on:clear"). |
It seems to me that this should follow the same API as the Search component. It would be nice to use this as a fuzzy autocomplete for navigation similar to when you're searching AWS for services (sorry, IBM! I'm not familiar w/ the IBM cloud!) |
A new
@DustinEwan I appreciate the sentiment but the HeaderSearch component – like with the regular Carbon Search component – does not contain business logic for searching/filter results. It's left to the user to provide the data to render. Particularly for global search, I'd imagine that in most cases the results would be served by the backend of an application (i.e. full text search on an extremely high volume of data or data that changes frequently). |
@metonym thanks for the follow up, and totally get it. I understand I would need to implement the logic. I guess what I was getting at was that it would be nice to have a list of matches render below the search field, just like a standard autocomplete. As it stands it seems like that only functionality at the moment is a text input where we need to capture the enter key and display a modal or navigate, etc., While I could wrap the HeaderActionSearch into a custom component, I didn't see a nice way of implementing a live updating list of results that feels like an autocomplete just using the components out of the box. Just checked out the new release and the usage demo was exactly what I was looking for, actually. |
With
on:inputSearch
firing per key press, what's the technique to wait until enter key has been pressed to action - this particular key stroke doesn't fire this event.The text was updated successfully, but these errors were encountered: