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

Stimulus for search field autocomplete #4468

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

martinemde
Copy link
Member

@martinemde martinemde commented Feb 19, 2024

Mostly identical in behavior, but removes jQuery and unifies the search form html besides a few classes. Adds little improvements to accessibility and a bit nicer handling of other common events like clicking out or hitting escape.

This also changes the way the search is loaded into the header, skipping rendering in pages that already have a search field in-page. This means there's always only one search field on a page.

@martinemde martinemde changed the title Stimulus autocomplete Stimulus for search field autocomplete Feb 19, 2024
Copy link

codecov bot commented Feb 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.15%. Comparing base (bdd4702) to head (14dcd56).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4468   +/-   ##
=======================================
  Coverage   97.15%   97.15%           
=======================================
  Files         391      391           
  Lines        8260     8261    +1     
=======================================
+ Hits         8025     8026    +1     
  Misses        235      235           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

Choose a reason for hiding this comment

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

should this be a partial instead of a layout? or a phlex component maybe?

Copy link
Member Author

@martinemde martinemde Feb 19, 2024

Choose a reason for hiding this comment

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

When you say "partial instead of layout" I'm confused. It's a partial in the layouts dir. should it move somewhere else?

Phlex components seem cool but they're also an extra barrier to entry. This is mostly code though, so it is reasonable. I thought about just making it a helper.

I'd be really happy to watch you run through the component stuff you made so I could start using it.

Copy link
Member

@simi simi Feb 19, 2024

Choose a reason for hiding this comment

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

Phlex components seem cool but they're also an extra barrier to entry. This is mostly code though, so it is reasonable. I thought about just making it a helper.

👍 I agree on this. Should we open discussion somewhere to get in sync on this topic? Meanwhile let's not block template changes because of this if possible.

@martinemde martinemde force-pushed the martinemde/stimulus-autocomplete branch from 78ddb8a to c53f139 Compare February 19, 2024 18:05
@@ -0,0 +1,98 @@
import { Controller } from "@hotwired/stimulus"

// TODO: Add suggest help text and aria-live
Copy link
Member

Choose a reason for hiding this comment

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

Is this TODO for later (other PR)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's kind of a burden to add this here and requires some extra style and i18n work.

@martinemde martinemde force-pushed the martinemde/stimulus-autocomplete branch from c53f139 to 8f49d59 Compare February 19, 2024 19:47
@martinemde martinemde force-pushed the martinemde/nav-while-logged-out branch from 16ea06d to e1dec5f Compare February 19, 2024 19:51
Base automatically changed from martinemde/nav-while-logged-out to master February 19, 2024 19:58
@martinemde martinemde force-pushed the martinemde/stimulus-autocomplete branch 2 times, most recently from af1ef5c to 6319cb0 Compare February 19, 2024 21:23
@martinemde martinemde force-pushed the martinemde/stimulus-autocomplete branch from 6319cb0 to 3fb86fb Compare February 28, 2024 00:41
@martinemde martinemde force-pushed the martinemde/stimulus-autocomplete branch from 3fb86fb to 14dcd56 Compare February 28, 2024 00:41
@martinemde
Copy link
Member Author

Responded to feedback and rebased.

@martinemde martinemde merged commit b888301 into master Feb 28, 2024
17 checks passed
@martinemde martinemde deleted the martinemde/stimulus-autocomplete branch February 28, 2024 17:14
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.

4 participants