Skip to content

Added input field to search speakers. #674

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grassiricardo
Copy link

@grassiricardo grassiricardo commented Apr 16, 2025

Added input field to search speakers.

This issue: #670

This result:

Captura de Tela 2025-04-15 às 23 28 46

Copy link
Member

@adrienpoly adrienpoly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for exploring this

I would like to have a more Turbo way of doing this where I think we could achieve a smoother behaviour like the one we have in the spotlight search

But before getting to deep in the technical stuff from a UX point of view I wonder if we should do a full page refresh with the results or get a typeahead results first and full results when pressing enter

Here is an example of the amazon UX

CleanShot.2025-04-18.at.09.18.14.mp4

Comment on lines +7 to +23
connect () {
this.timeout = null

if (this.hasInputTarget) {
this.inputTarget.focus()
this.inputTarget.selectionStart = this.inputTarget.selectionEnd = this.inputTarget.value.length
}
}

search () {
clearTimeout(this.timeout)

this.timeout = setTimeout(() => {
this.element.requestSubmit()
}, 800)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you want to maintain the focus in the field every time the page is updated with the search results and as you are doing a full page refresh you need this to maintain the focus.

I think with Turbo we could probably achieve the same thing in a more standard way. Either with setting the search field as permanent and doing a page morph or using turbo frame. They must be a way to do this without having to manually handle the focus

Also fo rthe timeout what you are trying to do manually is a debounce. You can use a similar debounce technic as in the spotlight stimulus controller

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrienpoly Can you explain to me better what you want to do? I really didn't understand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrienpoly can you help me?

@marcoroth marcoroth force-pushed the main branch 2 times, most recently from d35f39a to ec30df0 Compare August 9, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants