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: 修复 Tag onClick 为 undefined,鼠标点击也会出现边框样式 #40023

Merged
merged 2 commits into from
Jan 5, 2023

Conversation

crazyair
Copy link
Member

@crazyair crazyair commented Jan 5, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Tag onClick as undefined, click the mouse to display the border style
🇨🇳 Chinese 修复 Tag onClick 为 undefined,鼠标点击也会出现边框样式

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 366.74 KB (+2 B 🔺)
./dist/antd-with-locales.min.js 422.45 KB (+2 B 🔺)

@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Base: 99.99% // Head: 100.00% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (33a4477) compared to base (c8bc3ce).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 33a4477 differs from pull request most recent head 46e793a. Consider uploading reports for the commit 46e793a to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #40023   +/-   ##
========================================
  Coverage   99.99%   100.00%           
========================================
  Files         603       603           
  Lines       10256     10261    +5     
  Branches     2728      2733    +5     
========================================
+ Hits        10255     10261    +6     
+ Misses          1         0    -1     
Impacted Files Coverage Δ
components/tag/index.tsx 100.00% <100.00%> (ø)
components/tooltip/index.tsx 100.00% <0.00%> (+1.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

components/tag/index.tsx Outdated Show resolved Hide resolved
@crazyair crazyair merged commit 81a1ffd into master Jan 5, 2023
@crazyair crazyair deleted the fix-tag-click branch January 5, 2023 02:24
@@ -119,7 +119,8 @@ const InternalTag: React.ForwardRefRenderFunction<HTMLSpanElement, TagProps> = (
};

const isNeedWave =
'onClick' in props || (children && (children as React.ReactElement<any>).type === 'a');
typeof props.onClick === 'function' ||
(children && (children as React.ReactElement<any>).type === 'a');
Copy link
Member

Choose a reason for hiding this comment

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

解决什么问题?

Copy link
Contributor

Choose a reason for hiding this comment

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

@crazyair 来改一下 Changelog ?

Copy link
Member Author

@crazyair crazyair Jan 5, 2023

Choose a reason for hiding this comment

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

<Tooltip title="title">
    <Tag>demo</Tag>
</Tooltip>

hover 的 Tooltip,会给 children 注入 onClick,导致鼠标点击 Tag 会出现边框样式

@crazyair crazyair changed the title fix: 修复 Tag onClick 为 undefined 的判断方式 fix: 修复 Tag onClick 为 undefined,鼠标点击也会出现边框样式 Jan 5, 2023
SohaibRaza pushed a commit to SohaibRaza/ant-design that referenced this pull request Jan 6, 2023
* fix: 修复 Tag onClick 为 undefined 的判断方式

* feat: function
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.

3 participants