شرح صفوف ومحتوى الفقرة
لفتح النافذة الحوارية وإغلاقها تصريحياً دون الحاجة لكتابة دوال برمجية مخصصة، تربط HTML حاوية
<dialog popover> بأزرار التحكم عبر خاصيتي popovertarget وpopovertargetaction؛ حيث تحدد القيمتان show وhide أمر الفتح أو الإغلاق مباشرة.
HTML
<!-- Declarative dialog open and hide actions -->
<button type="button" popovertarget="delete-prompt">
Delete File
</button>
<dialog id="delete-prompt" popover>
<p>Confirm permanent deletion?</p>
<button type="button" popovertarget="delete-prompt"
popovertargetaction="hide">Cancel</button>
</dialog>
تقبل خاصية
popovertargetaction ثلاث قيم قياسية واضحة: القيمة الافتراضية toggle للتبديل بين الفتح والإغلاق، والقيمة show للفتح الحصري، والقيمة hide لإغلاق النافذة بسلاسة من داخلها.