Skip to content

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Dec 29, 2025

⚠️ This PR is based off #21641. Please review/merge first.
ℹ️ One of two possible implementations. See also #21639.

Ticket

https://community.openproject.org/wp/69641

What are you trying to accomplish?

Screenshots

What approach did you choose and why?

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@myabc myabc force-pushed the feature/69641-turbo-custom-dialogs branch 2 times, most recently from 2505b10 to 808d7c4 Compare January 12, 2026 22:51
@myabc myabc changed the title Feature/69641 turbo custom dialogs [#69641] Configure Turbo to use custom confirmation dialogs [Version 1] Jan 12, 2026
@myabc myabc requested a review from Copilot January 16, 2026 03:27
Copy link
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 configures Turbo to use custom confirmation dialogs instead of the browser's native confirm() dialog. It replaces the old deprecated setProgressBarDelay API with the new config-based approach, updates TypeScript type definitions to use the official @types/hotwired__turbo package, and implements a custom confirmation handler that integrates with OpenProject's existing ConfirmDialogService.

Changes:

  • Configured Turbo to use a custom confirm dialog handler that integrates with OpenProject's ConfirmDialogService
  • Updated type definitions to use official @types/hotwired__turbo types instead of custom definitions
  • Migrated from deprecated setProgressBarDelay() to config-based API

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/turbo/confirm.ts New file implementing custom Turbo confirmation dialog using ConfirmDialogService
frontend/src/turbo/setup.ts Configures Turbo with custom confirm handler and updates to use config API
frontend/src/typings/turbo.d.ts Removed custom type definitions that are now provided by @types/hotwired__turbo
frontend/src/typings/shims.d.ts Added Turbo config type definitions with forms.confirm property
frontend/package.json Moved @types/hotwired__turbo to devDependencies and updated version
frontend/package-lock.json Updated @types/hotwired__turbo version and marked as dev dependency
modules/meeting/frontend/module/main.ts Updated to use official Turbo types from @types/hotwired__turbo
frontend/src/app/core/main-menu/submenu.service.ts Updated to use FrameElement type from @types/hotwired__turbo
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

Comment on lines +44 to +47
.then((service) => service.confirm({
text: { title: I18n.t('js.modals.form_submit.title'), text: message },
dangerHighlighting
}))
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The I18n global is used without ensuring it's available. While I18n is declared as a global in shims.d.ts, the confirm function could potentially be called before I18n is initialized, leading to a runtime error. Consider accessing I18n through window.I18n to be more explicit about the global access, or add a safety check.

Suggested change
.then((service) => service.confirm({
text: { title: I18n.t('js.modals.form_submit.title'), text: message },
dangerHighlighting
}))
.then((service) => {
const i18n = (window as any).I18n;
const title = i18n ? i18n.t('js.modals.form_submit.title') : 'Confirm';
return service.confirm({
text: { title, text: message },
dangerHighlighting
});
})

Copilot uses AI. Check for mistakes.
const { detail: { response, visit } } = event;
event.preventDefault();
visit(response.url);
void visit(response.url, {});
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The visit function is being called with an empty options object, but the type signature and expected arguments for this function should be verified. The previous code called visit(response.url) without a second argument, and the addition of {} as a second argument may not be correct or necessary depending on the function signature.

Suggested change
void visit(response.url, {});
void visit(response.url);

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +35
export function confirm(
message:string,
formElement:HTMLFormElement,
submitter?:HTMLButtonElement|HTMLInputElement
) {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The new custom confirmation dialog functionality lacks test coverage. Given that this is a critical user-facing feature that affects form submissions throughout the application, comprehensive tests should be added covering: successful confirmation, cancellation, different HTTP methods (especially 'delete' for danger highlighting), and integration with ConfirmDialogService.

Copilot uses AI. Check for mistakes.
Use Angular `ConfirmDialogService` for the time-being.
@myabc myabc force-pushed the feature/69641-turbo-custom-dialogs branch from 26b30e0 to ee2f0c9 Compare January 16, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants