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: Dropdown should respect trigger's disabled prop #47363

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Feb 6, 2024

[中文版模板 / 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 Button disabled prop not working when it is Dropdown's children.
🇨🇳 Chinese 修复 Button 作为 Dropdown trigger 时 disabled 属性不生效的问题。

☑️ 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

Copy link

stackblitz bot commented Feb 6, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Feb 6, 2024

Preview failed

Copy link
Contributor

github-actions bot commented Feb 6, 2024

👁 Visual Regression Report for PR #47363 Passed ✅

🎯 Target branch: master (e2d7e68)
📖 View Full Report ↗︎

🎊 Congrats! No visual-regression diff found.

Copy link
Contributor

github-actions bot commented Feb 6, 2024

size-limit report 📦

Path Size
./dist/antd.min.js 337.51 KB (-397 B 🔽)
./dist/antd-with-locales.min.js 385.54 KB (+163 B 🔺)

});
};
if (typeof disabled !== 'undefined') {
dropdownTriggerProps.disabled = disabled;
Copy link
Member

Choose a reason for hiding this comment

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

HOC 和 context 都不会生效:

<ConfigProvider componentDisabled>
  <Dropdown><Button /></Dropdown>
</ConfigProvider>

直接到 feature 里把这个 disabled 传导去了要不?

Copy link
Member Author

Choose a reason for hiding this comment

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

图片

这个代码实测是生效的。

Copy link
Member

Choose a reason for hiding this comment

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

要设置一下 Dropdown 的 disabled:

<ConfigProvider componentDisabled>
  <Dropdown menu={{ items }} disabled={false}>
    <Button />
  </Dropdown>
</ConfigProvider>
截屏2024-02-07 23 53 32

Copy link

codesandbox-ci bot commented Feb 6, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e2d7e68) to head (5dd9fd3).

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #47363   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          746       746           
  Lines        12996     12997    +1     
  Branches      3412      3413    +1     
=========================================
+ Hits         12996     12997    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@afc163 afc163 marked this pull request as draft February 7, 2024 12:37
@afc163 afc163 force-pushed the fix/dropdown-trigger-disabled branch 2 times, most recently from 0d8a91c to a8e25a1 Compare February 7, 2024 14:16
@afc163 afc163 marked this pull request as ready for review February 7, 2024 14:16
li-jia-nan
li-jia-nan previously approved these changes Feb 7, 2024
@afc163 afc163 marked this pull request as draft February 8, 2024 03:55
@afc163 afc163 force-pushed the fix/dropdown-trigger-disabled branch from c59e3c1 to 14a3155 Compare February 18, 2024 12:18
@afc163 afc163 force-pushed the fix/dropdown-trigger-disabled branch from 14a3155 to 6497874 Compare February 21, 2024 02:28
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.

None yet

6 participants