Native Dialog Element Modal Animation: AI Prompt Example
CODE PREVIEW
Prompt
Create a native modal using the HTML <dialog> element with smooth open/close animations (GSAP). Include backdrop customization, focus trapping, and a close button. No libraries for the dialog itself, but use GSAP for entrance/exit transitions.
HTMLのネイティブ<dialog>要素を使って、GSAPアニメーション付きで滑らかに開閉するモーダルの作り方を解説。背景カスタマイズとフォーカストラップも自動で効きます。
Prompt Overview
This prompt demonstrates how to build a fully accessible native modal dialog using the HTML <dialog> element, enhanced with GSAP-powered entrance and exit animations. It is an ideal reference for front-end developers who want smooth, polished modal interactions without relying on heavyweight UI libraries. The generated output covers practical requirements such as backdrop customization, focus trapping for keyboard accessibility, and a working close button — all implemented with clean, maintainable vanilla JavaScript.
Use this prompt when you need a lightweight yet professional modal solution for landing pages, web apps, or portfolio projects. Because it leverages the browser-native <dialog> element, the result benefits from built-in accessibility semantics and avoids common pitfalls of DIY modal implementations. Pair it with any modern browser and a GSAP CDN link to reproduce the output instantly. Variations to explore include swapping GSAP for CSS keyframe animations, adding scroll-lock behavior, or extending the backdrop with a blur filter for a frosted-glass effect.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選