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

fix(autocomplete-js): query is reflected in the detached search button #1100

Merged
merged 6 commits into from
Mar 2, 2023

Conversation

FabienMotte
Copy link
Contributor

@FabienMotte FabienMotte commented Feb 28, 2023

Summary

Currently in autocomplete-js using the detached mode:

  • When the modal is closed (clicking on an item of the panel/using the cancel button/using the escape key), the query is reset.
  • The detached search button (used to open the modal) doesn't reflect the current query.

Result

  • In detached mode, the query is persisted in a new div with the class .aa-DetachedSearchButtonQuery.
  • When the query is not empty, the placeholder .aa-DetachedSearchButtonPlaceholder is hidden.

→ CodeSandbox

Fixes #636 and #1010

@FabienMotte FabienMotte changed the title fix(autocomplete-js): query is reflected in the detached search button fix(autocomplete-js): query is reflected in the detached search button Feb 28, 2023
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 28, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6d07470:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration
@algolia/autocomplete-example-starter (forked) PR
react-algolia-autocomplete-2 Issue #636

@FabienMotte FabienMotte changed the title fix(autocomplete-js): query is reflected in the detached search button fix(autocomplete-js): query is reflected in the detached search button Feb 28, 2023
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

this looks great to me, works as expected, and like the solution, even for long queries

@FabienMotte
Copy link
Contributor Author

this looks great to me, works as expected, and like the solution, even for long queries

Thanks! I added a couple of CSS rules for long queries.

image

Copy link
Member

@sarahdayan sarahdayan left a comment

Choose a reason for hiding this comment

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

Elegant solution! I left a few non blocking comments, feel free to address or not and merge 👍

packages/autocomplete-js/src/__tests__/detached.test.ts Outdated Show resolved Hide resolved
packages/autocomplete-js/src/__tests__/detached.test.ts Outdated Show resolved Hide resolved
packages/autocomplete-js/src/__tests__/detached.test.ts Outdated Show resolved Hide resolved
packages/autocomplete-js/src/__tests__/detached.test.ts Outdated Show resolved Hide resolved
FabienMotte and others added 3 commits March 2, 2023 11:01
Co-authored-by: Sarah Dayan <5370675+sarahdayan@users.noreply.github.com>
@FabienMotte FabienMotte merged commit a41ccc6 into next Mar 2, 2023
@FabienMotte FabienMotte deleted the fix/detached-mode-reflect-query branch March 2, 2023 13:11
@FabienMotte FabienMotte linked an issue May 4, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants