Skip to content

fix: make TagInput suggestion filter case-insensitive#941

Merged
ding113 merged 1 commit into
ding113:devfrom
sususu98:fix/tag-input-suggestion-filter
Mar 18, 2026
Merged

fix: make TagInput suggestion filter case-insensitive#941
ding113 merged 1 commit into
ding113:devfrom
sususu98:fix/tag-input-suggestion-filter

Conversation

@sususu98

@sususu98 sususu98 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the TagInput suggestion filter case-insensitive to align with the duplicate check added in #940.

Problem

Follow-up to #940

PR #940 made the TagInput duplicate validation case-insensitive, but the suggestion dropdown filter was still using case-sensitive matching. This caused confusing UX where:

  1. User has tag "OpenAPI" selected
  2. Suggestion dropdown shows "openapi" (different casing)
  3. User clicks "openapi" suggestion
  4. Selection fails with duplicate error (case-insensitive duplicate detected)

Solution

Update the suggestion filter to use case-insensitive comparison when checking if a suggestion is already selected:

- return haystack.includes(search) && (allowDuplicates || !value.includes(s.value));
+ return (
+   haystack.includes(search) &&
+   (allowDuplicates || !value.some((v) => v.toLowerCase() === s.value.toLowerCase()))
+ );

Changes

File Change
src/components/ui/tag-input.tsx Use case-insensitive comparison in suggestion filter

Testing

Manual Testing:

  1. Open a form with TagInput that has suggestions
  2. Add a tag (e.g., "OpenAPI")
  3. Verify the suggestion dropdown no longer shows case variations of already-selected tags (e.g., "openapi", "OPENAPI")

Checklist

  • Code follows project conventions
  • Self-review completed

Description enhanced by Claude AI

The suggestion dropdown still showed tags that only differed in casing
from already-selected tags (e.g. showing 'openapiHA' when 'openapiha'
was already selected). Selecting such a suggestion would then fail as
a duplicate, creating a confusing UX.

Follows up on the case-insensitive duplicate check added in ding113#940.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience of the TagInput component by resolving an issue where the suggestion dropdown would display tags that were case-insensitive duplicates of already-selected tags. By implementing a case-insensitive duplicate check, the component now consistently hides such suggestions, aligning with the existing duplicate prevention logic and preventing confusing interactions for users.

Highlights

  • TagInput Component: Modified the suggestion filtering logic in the TagInput component to perform case-insensitive checks for duplicate tags, preventing already-selected tags (differing only in casing) from appearing in the suggestion list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
📝 Walkthrough

概述

本PR修改了标签输入组件中的重复标签检查逻辑,将原有的区分大小写的直接包含检查改为不区分大小写的比较。同时更新了package.json文件。

变更

变更组/文件(s) 摘要
标签输入组件逻辑优化
src/components/ui/tag-input.tsx
修改标签建议过滤逻辑中的重复检查条件,从value.includes(s.value)改为value.some(v => v.toLowerCase() === s.value.toLowerCase()),实现不区分大小写的重复检查。
依赖配置更新
package.json
配置文件调整,新增4行,删除1行。

代码审查工作量估算

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地概括了主要变化:使TagInput建议过滤器不区分大小写,与代码变更内容完全对应。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed PR描述清晰详细地说明了问题、解决方案和更改内容,与代码变更完全相关。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added bug Something isn't working area:UI area:UX labels Mar 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

The pull request successfully addresses the issue of case-sensitive duplicate tag suggestions by implementing a case-insensitive check. This change aligns the suggestion filtering with the duplicate check logic, improving the user experience by preventing the selection of functionally identical tags that only differ in casing.

@github-actions github-actions Bot added the size/XS Extra Small PR (< 50 lines) label Mar 18, 2026
@ding113
ding113 merged commit 1ce12e1 into ding113:dev Mar 18, 2026
15 of 16 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap Mar 18, 2026
@github-actions github-actions Bot mentioned this pull request Mar 18, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI area:UX bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants