discourse/app/assets/stylesheets/common/base/dialog.scss
Régis Hanol 28dae66fb1
UX: Migrate permanently-delete confirmation to DModal (#39896)
The "Permanently delete" confirmation was rendered through the legacy
dialog service, which hard-coded `width: 25vw` on the container. On
narrow mobile viewports (e.g. Edge at ~320px) that collapsed to ~80px,
clipping the modal and rendering the danger button unusable.

Rebuild the confirmation as a proper DModal so it picks up responsive
sizing, mobile keyboard handling, and footer wrapping for free.

- Add `components/modal/permanently-delete-confirm.gjs` with the
type-to-confirm input, btn-danger confirm, cancel, and the easter egg.
- Update the two call sites (`controllers/topic.js`,
`components/modal/history.gjs`) to invoke it via `modal.show(...)`
instead of `dialog.confirm(...)`, and delete the now-unused
`dialog-messages/permanently-delete-confirm.gjs`.
- Move the related styles to `.permanently-delete-confirm-modal` in
modal.scss, drop the 25vw width override, and allow the long danger
label to wrap so it no longer overflows on small screens.
- Replace the dialog-holder coverage with a dedicated
`PermanentlyDeleteConfirm` page object and route the system specs
through it.

https://meta.discourse.org/t/402663

**BEFORE**

<img width="402" height="690" alt="2026-05-11 @ 20 05 10"
src="https://github.com/user-attachments/assets/fb9dbfa7-4070-4557-87ea-0c73dc2be728"
/>

**AFTER**

<img width="410" height="693" alt="2026-05-11 @ 20 04 03"
src="https://github.com/user-attachments/assets/ab975c45-d4aa-43e5-80dc-67578da2f25d"
/>
2026-05-12 11:42:52 +02:00

99 lines
1.7 KiB
SCSS
Vendored

.dialog-container,
.dialog-overlay {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.dialog-container {
z-index: z("modal", "dialog");
display: flex;
// fixes modal placement on Android when keyboard is visible
html.keyboard-visible:not(.ios-device) & {
height: calc(100% - env(keyboard-inset-height));
}
}
/**
* Ensures the dialog container and all its descendants are not
* visible and not focusable when it is hidden.
*/
.dialog-container[aria-hidden="true"] {
display: none;
}
@keyframes fade-in {
from {
opacity: 0;
}
}
.dialog-overlay {
background: rgb(var(--always-black-rgb), 0.65);
animation: fade-in 250ms both;
@media (prefers-reduced-motion) {
animation-duration: 0s;
}
}
.dialog-content {
margin: auto;
z-index: z("modal", "content");
position: relative;
background-color: var(--secondary);
box-shadow: var(--shadow-card);
min-width: 40vw;
animation: fade-in 250ms both;
@media (prefers-reduced-motion) {
animation-duration: 0s;
}
}
.dialog-body {
overflow-y: auto;
max-height: 400px;
max-width: 800px;
padding: 1em;
}
.dialog-header {
display: flex;
padding: 10px 15px;
border-bottom: 1px solid var(--content-border-color);
align-items: start;
h3 {
font-size: var(--font-up-3);
margin-bottom: 0;
}
.dialog-close {
margin-left: auto;
flex-basis: content;
padding-left: 15px;
.d-icon {
color: var(--primary-high);
}
}
}
.dialog-footer {
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 14px 15px 10px;
border-top: 1px solid var(--content-border-color);
--btn-bottom-margin: 0.3em;
.btn {
margin: 0 0.75em var(--btn-bottom-margin) 0;
}
}