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

Add an override to useTypeAhead behavior from @floating-ui/react allowing use <input /> in DropDown.Header #1394

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

dragonlipz
Copy link
Contributor

@dragonlipz dragonlipz commented May 13, 2024

This is for issue #1341 preventing the use of <input /> or <TextInput /> controls in the header section of a DropDown.

This Does add a new property to the <DropDown /> component to prevent default behavior of @floating-ui/react's useTypeAhead functionality. That, according to @floating-ui/react documentation, should not be used for typeable elements.

Note
This Hook should not be used for typeable <input /> elements. It is intended to be used on menu buttons for a dropdown menu or select menu, rather than a combobox that is searchable.

New Prop:
DropdownProps.enableTypeAhead?: boolean
default: true
Non-breaking, to existing behavior. When set to false, disables the 'useTypeAhead' functionality.

I'm uncertain if this is the desired naming of the property. disableTypeAhead seems more appropriate, but then it's negative use may be more confusing for users.

Summary by CodeRabbit

  • Documentation
    • Improved descriptions and instructions for using the React Dropdown component.
    • Added guidance on setting enableTypeAhead to false for complex headers with <input> or <TextInput> controls.
    • Enhanced clarity in defining the component's functionality, customization options, and usage examples.

… using input html types in header of DropDown
Copy link

changeset-bot bot commented May 13, 2024

⚠️ No Changeset found

Latest commit: 85e3dfb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 13, 2024

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

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 0:38am
flowbite-react-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 0:38am

Copy link
Contributor

coderabbitai bot commented May 13, 2024

Warning

Rate limit exceeded

@SutuSebastian has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 50 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 8de012c and 85e3dfb.

Walkthrough

The recent updates to the dropdown.mdx file enhance the documentation for the React Dropdown component. Key changes include clarifications on the component's functionality, usage, and customization options. Notably, it emphasizes the need to disable enableTypeAhead for more complex headers containing input controls to avoid keystrokes being misinterpreted as item searches. Additionally, the descriptions have been refined for better readability and comprehension.

Changes

Files Change Summary
.../dropdown.mdx Added an instruction for setting enableTypeAhead to false when using complex headers with input controls.
.../dropdown.mdx Improved clarity and instructions for the React Dropdown component, including refinements in terminology and examples.

Poem

In the realm of dropdowns, clear and bright,
We crafted changes, shining light,
On usage tips, so true refined,
For inputs mixed with care combined.
A rabbit’s joy, documentation clear,
Dropdowns now, with less to fear!
🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Out of diff range and nitpick comments (4)
apps/web/content/docs/components/dropdown.mdx (4)

Line range hint 6-6: Use "i.e." instead of "ie.".

- (ie. a button)
+ (i.e. a button)

Line range hint 8-8: Add a comma after "Tailwind CSS".

- Tailwind CSS and you can use
+ Tailwind CSS, and you can use

Line range hint 18-18: Remove "of" for conciseness.

- inside of the main `<Dropdown>` component.
+ inside the main `<Dropdown>` component.

Line range hint 68-68: Add a comma after "trigger element".

- trigger element you can use
+ trigger element, you can use
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2afa3c8 and 9ade36f.
Files selected for processing (3)
  • apps/web/content/docs/components/dropdown.mdx (1 hunks)
  • packages/ui/src/components/Dropdown/Dropdown.stories.tsx (1 hunks)
  • packages/ui/src/components/Dropdown/Dropdown.tsx (3 hunks)
Additional Context Used
LanguageTool (4)
apps/web/content/docs/components/dropdown.mdx (4)

Near line 6: The abbreviation “i.e.” (= that is) requires two periods.
Context: ...ems when clicking on a trigger element (ie. a button) that you can use to build dro...


Near line 8: Possible missing comma found.
Context: ... with the utility classes from Tailwind CSS and you can use the custom props from R...


Near line 18: This phrase is redundant. Consider using “inside”.
Context: ...ding child <Dropdown.Item> components inside of the main <Dropdown> component. <Exam...


Near line 68: It seems that a comma is missing.
Context: ...ustom trigger To customize the trigger element you can use renderTrigger property. ...

Additional comments not posted (5)
apps/web/content/docs/components/dropdown.mdx (1)

32-33: The added line is clear and provides necessary information about the new prop.

packages/ui/src/components/Dropdown/Dropdown.stories.tsx (1)

63-78: The new story WithUsableInputHeader is well-implemented and demonstrates the usage of the enableTypeAhead prop effectively.

packages/ui/src/components/Dropdown/Dropdown.tsx (3)

50-50: The new prop enableTypeAhead is correctly added to the DropdownProps interface.


112-112: The default value for enableTypeAhead is correctly set to true in the DropdownComponent.


169-169: The enableTypeAhead prop is correctly used to enable or disable the useTypeahead functionality.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Out of diff range and nitpick comments (1)
apps/web/content/docs/components/dropdown.mdx (1)

Line range hint 56-56: Add a comma for better readability.

There is a missing comma in the sentence.

- Use the `placement` prop to change the placement of the dropdown by choosing one of the following options: `top`, `right`, `bottom` or `left`. If there is not enough space then the dropdown will be automatically repositioned.
+ Use the `placement` prop to change the placement of the dropdown by choosing one of the following options: `top`, `right`, `bottom`, or `left`. If there is not enough space, then the dropdown will be automatically repositioned.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9ade36f and ea7bd48.
Files selected for processing (1)
  • apps/web/content/docs/components/dropdown.mdx (4 hunks)
Additional Context Used
LanguageTool (1)
apps/web/content/docs/components/dropdown.mdx (1)

Near line 56: Possible missing comma found.
Context: ...ttomorleft`. If there is not enough space then the dropdown will be automatically...

apps/web/content/docs/components/dropdown.mdx Outdated Show resolved Hide resolved
apps/web/content/docs/components/dropdown.mdx Outdated Show resolved Hide resolved
apps/web/content/docs/components/dropdown.mdx Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
SutuSebastian
SutuSebastian previously approved these changes Jun 19, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea7bd48 and 8de012c.

Files selected for processing (1)
  • apps/web/content/docs/components/dropdown.mdx (4 hunks)
Additional context used
LanguageTool
apps/web/content/docs/components/dropdown.mdx

[uncategorized] ~10-~10: A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Context: ...m props from React. To start using the component make sure that you have imported it fro...


[uncategorized] ~67-~67: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...tomize the trigger element, you can use renderTrigger property. <Example name=...

Additional comments not posted (4)
apps/web/content/docs/components/dropdown.mdx (4)

6-6: The updated description is clearer and more precise.


8-8: The revised description of default styles is more concise and easier to understand.


18-18: The instruction for creating a simple dropdown is well-phrased and clear.


32-32: The instruction for disabling enableTypeAhead when using <input> or <TextInput> in the dropdown header is crucial for proper functionality and is clearly explained.

apps/web/content/docs/components/dropdown.mdx Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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