Skip to content

fix: add explicit type attribute to button elements#10476

Open
NethmikaKekuu wants to merge 4 commits into
wso2:masterfrom
NethmikaKekuu:fix/button-has-type
Open

fix: add explicit type attribute to button elements#10476
NethmikaKekuu wants to merge 4 commits into
wso2:masterfrom
NethmikaKekuu:fix/button-has-type

Conversation

@NethmikaKekuu

@NethmikaKekuu NethmikaKekuu commented Jun 28, 2026

Copy link
Copy Markdown

Purpose

Fixes react-doctor/button-has-type lint warnings by adding an explicit
type="button" attribute to three <button> elements that were missing it.

Without an explicit type, buttons inside forms default to type="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

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified. (for internal contributers)
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Relevant backend changes deployed and verified
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

Developer Checklist (Mandatory)

  • Complete the Developer Checklist in the related product-is issue to track
    any behavioral change or migration impact.

No behavioural change, migration impact, or new configuration introduced by this fix.

@CLAassistant

CLAassistant commented Jun 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@pavinduLakshan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: b87b8d65-0d55-45d8-9243-43ebe7bc1508

📥 Commits

Reviewing files that changed from the base of the PR and between 8068253 and adc23a5.

📒 Files selected for processing (2)
  • .changeset/fix-button-has-type.md
  • features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx
📝 Walkthrough

Walkthrough

Three <button> elements across unrelated components are updated to include an explicit type="button" attribute, preventing them from acting as default form submit buttons when nested inside forms.

Changes

Explicit type="button" attribute fixes

Layer / File(s) Summary
Add type="button" to buttons in three components
features/admin.branding.v1/.../email-link-expiry-fragment.tsx, features/admin.flow-builder-core.v1/.../action.tsx, features/admin.users.v1/.../add-user-basic.tsx
The "Go Back" button in EmailLinkExpiryFragment, the Action DnD component button, and the hidden programmatic submit button in the add-user wizard step each receive an explicit type="button" attribute.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Changeset Required ❌ Error No new .changeset/*.md file is in the PR change set; only source files were updated, so the changeset requirement is unmet. Add a new .changeset/*.md (not README) covering the affected feature package(s) with the proper version bump.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding explicit type attributes to button elements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description matches the required template and includes purpose, issues, PRs, checklists, security checks, and developer checklist.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ create changeset

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Keep this button as an explicit submit control.

Line 369 still uses submitButtonRef.current?.click() to submit the form. After this change, the click only runs onSubmitClick(...); it no longer triggers <form onSubmit={ handleSubmit }>, so the wizard stops submitting programmatically. This should be type="submit" instead of type="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

📥 Commits

Reviewing files that changed from the base of the PR and between 0651514 and 8068253.

📒 Files selected for processing (3)
  • features/admin.branding.v1/components/preview/sign-in-box/fragments/email-link-expiry-fragment.tsx
  • features/admin.flow-builder-core.v1/components/dnd/action.tsx
  • features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx

@NethmikaKekuu

Copy link
Copy Markdown
Author

@pavinduLakshan Could you please review this

Comment thread .changeset/fix-button-has-type.md

@pavinduLakshan pavinduLakshan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

@NethmikaKekuu

Copy link
Copy Markdown
Author

@pavinduLakshan Is there any specific occourance you particularly need or all the three instances

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.

[React Doctor] button-has-type: <button> elements must have an explicit type attribute (3 occurrences)

3 participants