-
Notifications
You must be signed in to change notification settings - Fork 580
[WIP] [Form] requiredMark 属性设置为true 的话,所有的item 都会出现 ‘‘*’’ 号 #5994
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
Conversation
|
@uyarn 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
TDesign Component Site Preview Open
|
commit: |
Co-authored-by: uyarn <[email protected]>
|
@copilot Do you think the requiredMark API should be strongly associated with the required API? |
Yes, I believe the 1. Documentation Alignment 2. User Experience Consistency
3. Common Form Library Patterns 4. Addresses Core Issue API Behavior with Strong Association:
This maintains flexibility while ensuring visual consistency with actual validation behavior, following standard form UX patterns. Changes in commit 99a7974 |

This PR fixes an issue where setting
requiredMark=trueon a Form component would show the asterisk (*) on ALL form items, including those without required validation rules.Plan:
requiredMark=true, all form items show*regardless of required rulesform-item.tsxline 77-81*when field is actually required AND requiredMark is not explicitly falseChanges Made:
needRequiredMarkcomputed property inform-item.tsxto userequiredMark !== false && isRequiredinstead ofrequiredMark ?? isRequiredrequired-mark.test.tsxrequired-mark-test.vuefor manual verificationDesign Decision Confirmed:
After feedback review, confirmed that
requiredMarkshould be strongly associated with therequiredAPI for better UX:API Behavior:
requiredMark=true→ "show marks on required fields" ✅requiredMark=false→ "never show marks" ✅requiredMark=undefined→ "auto-detect from validation rules" ✅Verification Results:
✅ Logic verification confirms the fix addresses the exact issue:
requiredMark=true+ field has NO required rules → Fixed from showing*to NOT showing*✅ Design philosophy established:
requiredMarkandrequiredvalidation rulesRoot cause:
The previous logic
return requiredMark ?? isRequired;would returntruewhenrequiredMarkwas explicitlytrue, regardless of whether the field actually had required validation rules.Fix:
Changed to
return requiredMark !== false && isRequired;to ensure asterisk only appears on fields that are actually required (have required validation rules), while still respecting therequiredMark=falseoverride.This maintains flexibility while ensuring visual consistency with actual validation behavior, following standard form UX patterns.
Fixes #5983.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.