Skip to content

Fix dialogs markup#1709

Merged
lyubov-voloshko merged 3 commits intomainfrom
fix-dialogs-markup
Apr 8, 2026
Merged

Fix dialogs markup#1709
lyubov-voloshko merged 3 commits intomainfrom
fix-dialogs-markup

Conversation

@lyubov-voloshko
Copy link
Copy Markdown
Collaborator

@lyubov-voloshko lyubov-voloshko commented Apr 8, 2026

Summary by CodeRabbit

  • Documentation

    • Added guidelines for implementing forms in dialogs with proper submission handlers.
  • Refactor

    • Updated multiple dialog forms to use standard HTML form submission mechanics instead of ad-hoc click handlers, ensuring consistent behavior across form submission patterns.

Copilot AI review requested due to automatic review settings April 8, 2026 09:57
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

Standardizes form submission handling across Material dialogs by wrapping content in <form> elements with (ngSubmit) handlers, updating buttons to use explicit type attributes (type="submit" for submit actions, type="button" for cancel/secondary actions), and adding documentation guidance on the pattern.

Changes

Cohort / File(s) Summary
Documentation
frontend/CLAUDE.md
Added "Mat-Dialog Forms" section with guidelines and HTML example demonstrating required <form> wrapper with (ngSubmit), mat-dialog-content, mat-dialog-actions, and submit button type usage.
Dialog Templates - Form Restructuring
frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.html, frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.html, frontend/src/app/components/connections-list/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html, frontend/src/app/components/hosted-databases/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html
Wrapped dialog content/actions in <form> with (ngSubmit) handler; converted Save/primary buttons to type="submit" (removing explicit click handlers); updated Cancel buttons to type="button" and added name attributes to form inputs for proper form association.
Dialog Templates - Form Submission Overhaul
frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html, frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html
Restructured templates to use outer <form> with (ngSubmit) instead of nested forms; removed explicit click handlers from action buttons and updated button types (type="submit" for primary, type="button" for secondary); maintained disabled/loading state bindings.
Dialog Templates - Button Type Updates
frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.html, frontend/src/app/components/secrets/master-password-dialog/master-password-dialog.component.html
Updated Cancel/secondary buttons to explicitly use type="button"; changed primary action buttons to type="submit" with (ngSubmit) form handler instead of direct click bindings; added form input name attributes for form semantics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A dialog form, now structured clean,
With buttons typed as ne'er before seen,
Submit and button, each in their place,
Forms dancing with Angular grace!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix dialogs markup' accurately describes the main change: standardizing dialog form markup across multiple components by wrapping content in proper form elements and updating button types for form submission.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed Pull request improves security by implementing proper HTML form semantics, double-submission prevention via disabled buttons, and maintains all existing security controls without introducing vulnerabilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-dialogs-markup

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 and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes Angular Material dialog markup so dialogs containing form-like inputs submit via <form (ngSubmit)> with a type="submit" primary action, improving keyboard (Enter key) submission behavior and consistency across the frontend.

Changes:

  • Wrapped multiple mat-dialog-content/mat-dialog-actions blocks in <form (ngSubmit)=...> and converted primary action buttons to type="submit".
  • Added missing name attributes to ngModel-bound inputs for template-driven forms.
  • Documented the required dialog form pattern in frontend/CLAUDE.md.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html Wraps dialog content/actions in a form and submits via ngSubmit.
frontend/src/app/components/secrets/master-password-dialog/master-password-dialog.component.html Adds form submission flow and ensures ngModel has a name.
frontend/src/app/components/hosted-databases/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html Converts rename dialog to standard form submit pattern.
frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.html Enables Enter-to-save via form submit and fixes button types inside form.
frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.html Makes Export a real form submit and prevents Cancel from submitting.
frontend/src/app/components/connections-list/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html Converts save action to submit and adds name for ngModel.
frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html Wraps dialog in form and submits delete via ngSubmit.
frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.html Makes primary action explicitly type="submit" for the existing form.
frontend/CLAUDE.md Adds a documented convention for mat-dialog forms and submit buttons.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<button mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button mat-flat-button color="warn"
(click)="openDeleteConfirmation()">
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

mat-dialog-close is specified twice on this button (mat-dialog-close mat-dialog-close="cancel"). Duplicate attributes are invalid HTML and can lead to confusing behavior; keep a single close binding (e.g., only mat-dialog-close="cancel" or a single [mat-dialog-close] binding).

Suggested change
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>

Copilot uses AI. Check for mistakes.
<button mat-flat-button color="warn"
[disabled]="submitting"
(click)="deleteConnection()">
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

mat-dialog-close is duplicated on this button (mat-dialog-close mat-dialog-close="cancel"). Please remove the redundant attribute and keep a single close value/binding to avoid invalid markup.

Suggested change
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html (1)

12-20: Use built-in control flow instead of structural directives.

The changed lines use *ngFor and *ngIf, but the coding guidelines require using built-in control flow (@for, @if) in all new code.

♻️ Suggested refactor using built-in control flow
-        <div *ngFor="let reasonItem of reasonsList">
-            <mat-radio-button [value]="reasonItem.id" class="radio-button">
-                {{ reasonItem.caption }}
-            </mat-radio-button>
-            <p *ngIf="reasonItem.message && reason === reasonItem.id"
-                [innerHtml]="reasonItem.message"
-                class="mat-body-1 radio-group__message">
-            </p>
-        </div>
+        `@for` (reasonItem of reasonsList; track reasonItem.id) {
+            <div>
+                <mat-radio-button [value]="reasonItem.id" class="radio-button">
+                    {{ reasonItem.caption }}
+                </mat-radio-button>
+                `@if` (reasonItem.message && reason === reasonItem.id) {
+                    <p [innerHtml]="reasonItem.message"
+                        class="mat-body-1 radio-group__message">
+                    </p>
+                }
+            </div>
+        }

As per coding guidelines: "Use built-in control flow (@if, @for, @switch) instead of structural directives (*ngIf, *ngFor, *ngSwitch) in all new code"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html`
around lines 12 - 20, Replace the structural directives with Angular built-in
control flow syntax: change the loop over reasonsList from "*ngFor" to "@for"
(e.g., `@for`="let reasonItem of reasonsList") and change the conditional "*ngIf"
on the message paragraph to "@if" (e.g., `@if`="reasonItem.message && reason ===
reasonItem.id"), keeping the existing bindings ([value]="reasonItem.id", {{
reasonItem.caption }}, [innerHtml]="reasonItem.message") and CSS classes
(radio-button, radio-group__message) on the same elements (mat-radio-button and
the paragraph) so the markup and behavior of reasonsList, reasonItem and reason
remain identical while using `@for/`@if.
frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html (1)

9-12: Consider enforcing form validation on submit.

The radio group has required but the submit button is only disabled by [disabled]="submitting". The required constraint won't prevent submission since the form's validity state isn't checked. If the required is intentional, consider adding form validation:

Optional: Disable submit when form is invalid
   <button type="submit" mat-flat-button color="warn"
-    [disabled]="submitting">
+    [disabled]="submitting || !deleteConnectionForm.valid">
     Proceed
   </button>

Also applies to: 35-36

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html`
around lines 9 - 12, The radio group uses required but the submit button only
checks [disabled]="submitting", so the form can submit with no selection; update
the template to use an Angular form (e.g., add `#deleteForm`="ngForm" on the form
element and bind (ngSubmit) to the existing submit handler) and change the
submit button's disabled binding to also check form validity (e.g.,
[disabled]="submitting || deleteForm.invalid"). Also update the component's
submit method (onDelete/onSubmit) to guard on the form or the reason model
(reason) and return early if the form is invalid to enforce server-side safety.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html`:
- Line 34: In the DbConnectionDeleteDialogComponent template, remove the
duplicate mat-dialog-close attribute on the Abort button so only the
value-bearing attribute remains; specifically, delete the bare mat-dialog-close
and keep mat-dialog-close="cancel" on the <button> element to avoid duplicate
attributes.

In
`@frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html`:
- Line 30: The Abort button element in account-delete-dialog.component.html
incorrectly includes the mat-dialog-close attribute twice; remove the duplicate
plain mat-dialog-close attribute and keep the value form
mat-dialog-close="cancel" on the <button> so the dialog close payload is
explicit (locate the Abort button element in
account-delete-dialog.component.html and delete the redundant mat-dialog-close
occurrence).

---

Nitpick comments:
In
`@frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html`:
- Around line 9-12: The radio group uses required but the submit button only
checks [disabled]="submitting", so the form can submit with no selection; update
the template to use an Angular form (e.g., add `#deleteForm`="ngForm" on the form
element and bind (ngSubmit) to the existing submit handler) and change the
submit button's disabled binding to also check form validity (e.g.,
[disabled]="submitting || deleteForm.invalid"). Also update the component's
submit method (onDelete/onSubmit) to guard on the form or the reason model
(reason) and return early if the form is invalid to enforce server-side safety.

In
`@frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html`:
- Around line 12-20: Replace the structural directives with Angular built-in
control flow syntax: change the loop over reasonsList from "*ngFor" to "@for"
(e.g., `@for`="let reasonItem of reasonsList") and change the conditional "*ngIf"
on the message paragraph to "@if" (e.g., `@if`="reasonItem.message && reason ===
reasonItem.id"), keeping the existing bindings ([value]="reasonItem.id", {{
reasonItem.caption }}, [innerHtml]="reasonItem.message") and CSS classes
(radio-button, radio-group__message) on the same elements (mat-radio-button and
the paragraph) so the markup and behavior of reasonsList, reasonItem and reason
remain identical while using `@for/`@if.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e3eb7b0-3397-4261-ba77-137ae65fca58

📥 Commits

Reviewing files that changed from the base of the PR and between 3b4ea7c and d22d81f.

📒 Files selected for processing (9)
  • frontend/CLAUDE.md
  • frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.html
  • frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html
  • frontend/src/app/components/connections-list/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html
  • frontend/src/app/components/dashboard/db-table-view/db-table-export-dialog/db-table-export-dialog.component.html
  • frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.html
  • frontend/src/app/components/hosted-databases/hosted-database-rename-dialog/hosted-database-rename-dialog.component.html
  • frontend/src/app/components/secrets/master-password-dialog/master-password-dialog.component.html
  • frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html

<button mat-flat-button color="warn"
[disabled]="submitting"
(click)="deleteConnection()">
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate mat-dialog-close attributes.

The button has both mat-dialog-close (without value) and mat-dialog-close="cancel". Only the second one is needed.

Proposed fix
-  <button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
+  <button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.html`
at line 34, In the DbConnectionDeleteDialogComponent template, remove the
duplicate mat-dialog-close attribute on the Abort button so only the
value-bearing attribute remains; specifically, delete the bare mat-dialog-close
and keep mat-dialog-close="cancel" on the <button> element to avoid duplicate
attributes.

<button mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button mat-flat-button color="warn"
(click)="openDeleteConfirmation()">
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate mat-dialog-close attribute.

The Abort button has mat-dialog-close specified twice. The second instance with the value will override the first, but this is likely unintentional and should be cleaned up.

🔧 Proposed fix
-  <button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
+  <button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button type="button" mat-flat-button mat-dialog-close mat-dialog-close="cancel">Abort</button>
<button type="button" mat-flat-button mat-dialog-close="cancel">Abort</button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/app/components/user-settings/account-delete-dialog/account-delete-dialog.component.html`
at line 30, The Abort button element in account-delete-dialog.component.html
incorrectly includes the mat-dialog-close attribute twice; remove the duplicate
plain mat-dialog-close attribute and keep the value form
mat-dialog-close="cancel" on the <button> so the dialog close payload is
explicit (locate the Abort button element in
account-delete-dialog.component.html and delete the redundant mat-dialog-close
occurrence).

@lyubov-voloshko lyubov-voloshko merged commit c0a64fe into main Apr 8, 2026
15 checks passed
@lyubov-voloshko lyubov-voloshko deleted the fix-dialogs-markup branch April 8, 2026 10:03
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.

2 participants