input icon indicating copy to clipboard operation
input copied to clipboard

fix: use button tag and native tabindex for clear button

Open vtx-anton-chashchin opened this issue 1 year ago • 4 comments

vtx-anton-chashchin avatar Jan 15 '24 12:01 vtx-anton-chashchin

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.34%. Comparing base (c0dd6ed) to head (152a4c0). Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   92.34%   92.34%           
=======================================
  Files           5        5           
  Lines         222      222           
  Branches       79       77    -2     
=======================================
  Hits          205      205           
  Misses         17       17           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 16 '24 04:01 codecov[bot]

@afc163 @MadCcc @zombieJ Can you please review this PR? It's an important a11y improvement that my team needs. Thanks!

mellis481 avatar Jan 18 '24 14:01 mellis481

@afc163 @MadCcc @zombieJ bump

mellis481 avatar Feb 07 '24 15:02 mellis481

@afc163 @MadCcc @zombieJ Can you please merge this PR?

mellis481 avatar Apr 02 '24 14:04 mellis481

Walkthrough

此次更改涉及到三个主要文件,分别是 assets/index.lesssrc/BaseInput.tsxtests/BaseInput.test.tsx。在 assets/index.less 中,修改了 .rc-input 组件的样式,特别是清除图标的样式。src/BaseInput.tsx 文件将清除图标从 <span> 元素更改为 <button> 元素,以提升可访问性和交互性,同时保留了相关的事件处理逻辑。在 tests/BaseInput.test.tsx 中,测试用例进行了重构,以更好地模拟用户交互并测试清除功能。

Changes

文件路径 更改摘要
assets/index.less 修改 .rc-input 组件的 .rc-input-clear-icon 样式,设置 padding0,移除 cursor,并将 backgroundborder 设置为 none
src/BaseInput.tsx 将清除图标从 <span> 元素更改为 <button> 元素,移除不必要的 roletabIndex 属性,保留事件处理逻辑。
tests/BaseInput.test.tsx 重构 allowClear 功能的测试,增加多个 it 测试以评估不同的清除交互方式,使用 userEvent 模拟用户行为。

Possibly related PRs

  • #81: Input 组件的事件处理更改可能与 BaseInput 组件的清除图标功能相关,因为两者都涉及输入组件中的用户交互和事件管理。

Poem

在草地上跳跃的小兔子,
清除图标变得更可爱,
按钮替代了小小的标记,
交互更友好,真是精彩!
测试用例也更清晰,
让我们一起欢呼,真是美丽! 🐇✨


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.

CodeRabbit Configuration 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.

coderabbitai[bot] avatar Nov 29 '24 07:11 coderabbitai[bot]

https://github.com/react-component/input/releases/tag/v1.7.0

afc163 avatar Nov 29 '24 07:11 afc163