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: prevent frozen InputSearch after text editing #658

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

wp-aberg
Copy link
Contributor

@wp-aberg wp-aberg commented Aug 15, 2024

What I did

This PR slightly refactors input search to better respond to keyboard interaction and edits to selected text, as well as adding an interaction test story to validate

Steps to test

  1. Start searching
  2. Key down to one of the autocomplete suggestions
  3. Try making a change to the autocomplete result in the search bar by backspacing or typing more letters
  4. Changes are made as expected
  5. Clear the search bar by clicking the x icon, it clears as expected

STRY-679

@wp-aberg wp-aberg requested a review from a team as a code owner August 15, 2024 16:17
Copy link

vercel bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
wpds-ui-kit ✅ Ready (Inspect) Visit Preview Aug 15, 2024 5:50pm
wpds-ui-kit-storybook ✅ Ready (Inspect) Visit Preview Aug 15, 2024 5:50pm

Copy link

@tamstephanie tamstephanie left a comment

Choose a reason for hiding this comment

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

LGTM!

packages/kit/src/input-search/InputSearchInput.tsx Outdated Show resolved Hide resolved
Comment on lines +304 to +312
await userEvent.keyboard("[ArrowDown]");
await userEvent.keyboard("[ArrowDown]");
await userEvent.keyboard("[ArrowDown]");
await expect(input).toHaveDisplayValue("Orange");
await userEvent.keyboard("[Backspace]");
await expect(input).toHaveDisplayValue("Orang");
const clearButton = await screen.findByText("Clear");
await userEvent.click(clearButton);
await expect(input).toHaveDisplayValue("");
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooo very cool!

@wp-aberg wp-aberg merged commit b3efa3e into main Aug 27, 2024
10 of 11 checks passed
@wp-aberg wp-aberg deleted the input-search-keyboard-fix branch August 27, 2024 20:24
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.

3 participants