Skip to content

Create SuggestBox component#3230

Merged
koesie10 merged 2 commits intomainfrom
koesie10/suggest-box
Jan 17, 2024
Merged

Create SuggestBox component#3230
koesie10 merged 2 commits intomainfrom
koesie10/suggest-box

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Jan 11, 2024

This creates a SuggestBox component that can be used for a VS Code-like autocomplete on a list of options.

Screen.Recording.2024-01-11.at.15.29.47.mov

This does not yet wire it up to anything, nor does it use the functions introduced in #3218. This component is not specific to access paths and could be used for any list of options with follow-up options.

The component uses @floating-ui/react to correctly position the suggestions and to implement accessibility correctly. Documentation about this can be found on the Floating UI docs. The example most like this implementation is the Autocomplete (combobox) example.

To test this, you can use Storybook. There are also unit tests for most of the functionality of the component.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Base automatically changed from koesie10/suggest-box-helper-functions to main January 16, 2024 08:35
@koesie10 koesie10 marked this pull request as ready for review January 16, 2024 08:37
@koesie10 koesie10 requested a review from a team as a code owner January 16, 2024 08:37
@koesie10 koesie10 requested a review from a team January 16, 2024 08:37
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

I mainly played around with this in Storybook, since the code and tests look pretty comprehensive. One question, but otherwise LGTM!

Comment on lines +22 to +26
const Input = styled(VSCodeTextField)`
width: 430px;

font-family: var(--vscode-editor-font-family);
`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this have a specified background colour too? When I tested in Storybook, the light themes looked like this:
image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That seems to be a bug in the Storybook theme, it does work correctly when rendered in VS Code. You can see the same behavior in for example the Variant analysis story.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, I see! That's annoying, but good to know that it's fine in VS Code 👌🏽

Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

🚢

@koesie10 koesie10 merged commit 75065f3 into main Jan 17, 2024
@koesie10 koesie10 deleted the koesie10/suggest-box branch January 17, 2024 14:56
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