The dialogs, or modal components, are implemented thorugh the rails helper decidim_modal
.
An dialog requires two elements:
1. A user actionable element, with the data-attribute data-dialog-open="example"
, where example is the id
of the modal.
2. A modal element, whose id
matches the data-target value the trigger refers to.
Source code on GitHub: <%= link_to("decidim-core/app/packs/src/decidim/a11y.js", "https://github.com/decidim/decidim/blob/develop/decidim-core/app/packs/src/decidim/a11y.js", target: "_blank", rel: "noopener noreferrer") %>
In order to display a complex modal, matching up the styles, do the following markup:
Pay attention to the data-attributes and the ids. For instance, the [data-dialog-title]
's id starts with dialog-title plus the modal id.