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(theme): removed pseudo cancel btn from input #3912

Merged
merged 4 commits into from
Oct 19, 2024

Conversation

sanuj21
Copy link
Contributor

@sanuj21 sanuj21 commented Oct 17, 2024

Closes #3907

📝 Description

Pseudo Cancel Button used to come with input element in chrome unintentionally when the input type is search.

⛳️ Current behavior (updates)

Pseudo Cancel Button comes with input element in chrome when the type is search.
Screenshot from 2024-10-18 04-38-40

🚀 New behavior

Removed the cancel button which was unintentional.
Screenshot from 2024-10-18 04-41-06

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Summary by CodeRabbit

Copy link

changeset-bot bot commented Oct 17, 2024

🦋 Changeset detected

Latest commit: 7fffe11

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nextui-org/theme Patch
@nextui-org/react Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Oct 17, 2024

@sanuj21 is attempting to deploy a commit to the NextUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Oct 17, 2024

Walkthrough

This pull request introduces a patch for the @nextui-org/theme package, specifically addressing the removal of a pseudo cancel button from the input component. This change is in response to the issue where two clear icons appeared in the <Input /> component.

Changes

File Path Change Summary
.changeset/forty-doors-flash.md Applied a patch to the @nextui-org/theme package to remove the pseudo cancel button from inputs.

Assessment against linked issues

Objective Addressed Explanation
Remove the extra clear icons from <Input /> (3907)

Possibly related PRs

Suggested labels

👀 Status: In Review

Suggested reviewers

  • jrgarciadev

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b6aba19 and 7fffe11.

📒 Files selected for processing (1)
  • .changeset/forty-doors-flash.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/forty-doors-flash.md

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

🧹 Outside diff range and nitpick comments (1)
packages/core/theme/src/components/input.ts (1)

49-49: LGTM! Consider adding a comment for clarity.

The addition of the "input-search-cancel-button-none" class effectively addresses the issue of the unintended cancel button in search inputs. This change aligns well with the PR objective and doesn't introduce any side effects to other component variants.

For improved maintainability, consider adding a brief comment explaining the purpose of this class, such as:

 input: [
   "w-full font-normal bg-transparent !outline-none placeholder:text-foreground-500 focus-visible:outline-none",
   "data-[has-start-content=true]:ps-1.5",
   "data-[has-end-content=true]:pe-1.5",
   "file:cursor-pointer file:bg-transparent file:border-0",
   "autofill:bg-transparent bg-clip-text",
+  // Hides the browser's default cancel button in search inputs
   "input-search-cancel-button-none",
 ],
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8a33eab and d76e36b.

📒 Files selected for processing (3)
  • .changeset/forty-doors-flash.md (1 hunks)
  • packages/core/theme/src/components/input.ts (1 hunks)
  • packages/core/theme/src/utilities/custom.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/forty-doors-flash.md
🧰 Additional context used
🔇 Additional comments (1)
packages/core/theme/src/utilities/custom.ts (1)

20-24: Approved: Effectively addresses the Chrome-specific issue.

The implementation correctly targets the WebKit search cancel button and hides it, which aligns with the PR objectives to remove the unintended cancel button in Chrome.

However, consider the following suggestions:

  1. Cross-browser compatibility: This solution is WebKit-specific. Consider adding similar rules for other browsers if they have equivalent pseudo-elements.
  2. Documentation: Add a comment explaining the purpose of this utility class and its browser limitations.

Consider adding a comment above the utility class for clarity:

+  // Hides the WebKit-specific search input cancel button
   ".input-search-cancel-button-none": {
     "&::-webkit-search-cancel-button": {
       "-webkit-appearance": "none",
     },
   },

Let's check if there are any non-WebKit specific solutions or if other browsers need similar treatment:

✅ Verification successful

Let's re-verify the codebase for other browser-specific input cancel button styles by running the following scripts:


Verified: No additional browser-specific styles found.

The implementation effectively addresses the Chrome-specific issue. As no other browser-specific input cancel button styles were detected in the codebase, no additional cross-browser adjustments are necessary at this time.

It is recommended to document the WebKit-specific styling and its limitations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for browser-specific input cancel button styles

# Test: Search for other browser-specific cancel button styles
rg --type css -i '(search-cancel-button|clear-button)'

# Test: Search for general input styling that might affect cancel buttons
rg --type css -i 'input\[type="search"\]'

Length of output: 100


Script:

#!/bin/bash
# Description: Search for browser-specific input cancel button styles

# Search for WebKit-specific cancel button styles
rg --type css '::-webkit-search-cancel-button'

# Search for Mozilla-specific clear button styles
rg --type css '::-moz-search-cancel-button'

# Search for general search input modifiers that might affect cancel buttons
rg --type css 'input\[type="search"\]'

Length of output: 131

Copy link

vercel bot commented Oct 18, 2024

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

Name Status Preview Comments Updated (UTC)
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2024 2:52am

Copy link
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

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

it's still here. please double check.

<Input isClearable type="search" variant="underlined" />
image

@sanuj21
Copy link
Contributor Author

sanuj21 commented Oct 18, 2024

@wingkwong I checked it again its working while running with storybook.
However, I tried to replicate the same scenerio using a test project and than linking to the nextui using pnpm link.
But while linking, it creates a symlink of folder nextui in node_modules, but we import from @nextui-org right.
Is it an alias issue, or its a build folder ?
Or is there any specific way to setup this ?

@wingkwong
Copy link
Member

I also tested in storybook only. Which browser were you testing in?

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.

[BUG] - Two(instead of one) clear icons pop up from <Input />
2 participants