fix: add explicit type attribute to button elements#10476
fix: add explicit type attribute to button elements#10476NethmikaKekuu wants to merge 4 commits into
Conversation
|
Warning Review limit reached
Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThree ChangesExplicit
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx (1)
1368-1374: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep this button as an explicit submit control.
Line 369 still uses
submitButtonRef.current?.click()to submit the form. After this change, the click only runsonSubmitClick(...); it no longer triggers<form onSubmit={ handleSubmit }>, so the wizard stops submitting programmatically. This should betype="submit"instead oftype="button".Suggested fix
<button - type="button" + type="submit" ref={ submitButtonRef } onClick={ () => onSubmitClick(hasValidationErrors) } hidden />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx` around lines 1368 - 1374, The hidden button in add-user-basic is no longer acting as an actual form submit control, so programmatic submissions via submitButtonRef.current?.click() bypass the form’s onSubmit handler. Update the button in the add-user-basic component to use explicit submit behavior again (keep the hidden ref-based control, but make it type submit) so clicking it still routes through handleSubmit and onSubmitClick in the wizard flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx`:
- Around line 1368-1374: The hidden button in add-user-basic is no longer acting
as an actual form submit control, so programmatic submissions via
submitButtonRef.current?.click() bypass the form’s onSubmit handler. Update the
button in the add-user-basic component to use explicit submit behavior again
(keep the hidden ref-based control, but make it type submit) so clicking it
still routes through handleSubmit and onSubmitClick in the wizard flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 14b5278c-4aea-4062-b019-d0f83a2dea1b
📒 Files selected for processing (3)
features/admin.branding.v1/components/preview/sign-in-box/fragments/email-link-expiry-fragment.tsxfeatures/admin.flow-builder-core.v1/components/dnd/action.tsxfeatures/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx
|
@pavinduLakshan Could you please review this |
pavinduLakshan
left a comment
There was a problem hiding this comment.
hi @NethmikaKekuu, thank you for the PR. Could you please run the console locally and verify the changed components are functioning as expected, and attach a screen recording to the PR?
|
@pavinduLakshan Is there any specific occourance you particularly need or all the three instances |
Purpose
Fixes
react-doctor/button-has-typelint warnings by adding an explicittype="button"attribute to three<button>elements that were missing it.Without an explicit
type, buttons inside forms default totype="submit"in HTML, which can cause unintended form submissions. This change makes the
intent explicit and resolves the correctness warnings flagged by React Doctor.
Affected files:
admin.branding.v1/components/preview/sign-in-box/fragments/email-link-expiry-fragment.tsx(line 60)admin.flow-builder-core.v1/components/dnd/action.tsx(line 63)admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx(line 1369)Related Issues
<button>elements must have an explicittypeattribute (3 occurrences) product-is#27877Related PRs
Checklist
Security checks
Developer Checklist (Mandatory)
product-isissue to trackany behavioral change or migration impact.