نافذة حوار Modal Dialog
نافذة تظهر في منتصف الشاشة وتعطّل كل ما خلفها حتى تردّ عليها.
<dialog> + showModal()متى تستخدمه
لقرار يجب اتخاذه الآن: تأكيد حذف، أو نموذج قصير.
خطأ شائع
لا تفتح نافذة فوق نافذة، ولا تضع فيها محتوى طويلاً يحتاج إلى تمرير.
إمكانية الوصول
Trap focus inside, close on Esc, and return focus to the button that opened it.
اسمه في الكود
| HTML/CSS | <dialog> + showModal() |
|---|---|
| React | <Dialog> — Radix / shadcn |
| Jetpack Compose | AlertDialog / Dialog |
| SwiftUI | .alert / .confirmationDialog |
برومبت جاهز لوكيل البرمجة
Add a Modal Dialog to this screen.
What it is: A window centered over the page that blocks everything behind it until you respond.
Implement with: <dialog> + showModal() (HTML/CSS).
Accessibility: Trap focus inside, close on Esc, and return focus to the button that opened it.
When to use it: For a decision needed right now: confirming a delete, or a short form.
Avoid: Don’t stack modals, and don’t put long scrolling content inside one.
Reuse the project's existing design tokens, spacing and component conventions.
أو ركّب صفحة كاملة من هذا العنصر وغيره →
البرومبت بالإنجليزية لأنها الأدق مع Claude Code وأمثاله.