<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jenitha Baskaran on Medium]]></title>
        <description><![CDATA[Stories by Jenitha Baskaran on Medium]]></description>
        <link>https://medium.com/@jeni_bas21?source=rss-9a7e9bccf716------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*rVY14gMzz3yE1ldU</url>
            <title>Stories by Jenitha Baskaran on Medium</title>
            <link>https://medium.com/@jeni_bas21?source=rss-9a7e9bccf716------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:32:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeni_bas21/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AEM’s Two-Column Layout for Enhanced Web Development]]></title>
            <link>https://medium.com/activate-aem/aems-two-column-layout-for-enhanced-web-development-01699a110cfe?source=rss-9a7e9bccf716------2</link>
            <guid isPermaLink="false">https://medium.com/p/01699a110cfe</guid>
            <category><![CDATA[aem-tips-for-developers]]></category>
            <category><![CDATA[2-column-with-aem]]></category>
            <category><![CDATA[aem-development]]></category>
            <category><![CDATA[adobe-aem]]></category>
            <category><![CDATA[aem-as-cloud-service]]></category>
            <dc:creator><![CDATA[Jenitha Baskaran]]></dc:creator>
            <pubDate>Fri, 04 Oct 2024 09:17:27 GMT</pubDate>
            <atom:updated>2024-10-04T11:59:55.484Z</atom:updated>
            <content:encoded><![CDATA[<p>The two-column layout is a fundamental feature in web design, offering a balanced and structured approach to presenting content. In AEM, a two-column layout component allows developers and content authors to divide web page content into two distinct columns. This division is not merely aesthetic but also serves practical purposes, such as improved readability, visual hierarchy, and responsive design. This blog explores how AEM leverages the two-column layout component to enhance web development and content presentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9f0fPVj960jeRPUMyyGHQg.png" /><figcaption>Experience Web Development: Design Smarter with AEM’s Two-Column Layout.</figcaption></figure><h4><strong>Dynamic Design for Diverse Needs</strong></h4><p>The two-column layout component in AEM provides developers with a flexible grid system to organize and display content on web pages. It adapts effortlessly to a variety of content types:</p><ul><li><strong>Interactive Landing Pages</strong>: Create impactful first impressions by combining media-rich elements with informative text, guiding users through a compelling narrative.</li><li><strong>Flexible Content Blocks</strong>: Seamlessly integrate diverse content elements such as images, videos, forms, and CTAs within a structured grid system, optimising user engagement and conversion paths.</li></ul><h4><strong>Technical Details:</strong></h4><p><strong>Back-end:</strong></p><ul><li>Add a dialogue field that will allow an author to specify the required data.</li></ul><pre>&lt;jcr:root xmlns:sling=&quot;http://sling.apache.org/jcr/sling/1.0&quot; xmlns:granite=&quot;http://www.adobe.com/jcr/granite/1.0&quot; <br>          xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot; xmlns:nt=&quot;http://www.jcp.org/jcr/nt/1.0&quot; <br>          xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; <br>          jcr:primaryType=&quot;nt:unstructured&quot; <br>          jcr:title=&quot;Two Column Layout&quot; <br>          sling:resourceType=&quot;cq/gui/components/authoring/dialog&quot;&gt; <br>    &lt;content<br>        jcr:primaryType=&quot;nt:unstructured&quot; <br>        sling:resourceType=&quot;granite/ui/components/foundation/container&quot;&gt; <br>        &lt;layout <br>            jcr:primaryType=&quot;nt:unstructured&quot; <br>            sling:resourceType=&quot;granite/ui/components/foundation/layouts/fixedcolumns&quot;/&gt; <br>        &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt; <br>            &lt;column <br>                jcr:primaryType=&quot;nt:unstructured&quot; <br>                sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;&gt; <br>                &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt; <br>                    &lt;cards <br>                        jcr:primaryType=&quot;nt:unstructured&quot; <br>                        sling:resourceType=&quot;granite/ui/components/coral/foundation/form/multifield&quot; <br>                        composite=&quot;{Boolean}true&quot; <br>                        fieldLabel=&quot;Statement Cards&quot; <br>                        required=&quot;true&quot; <br>                        validation=&quot;multifield-length&quot;&gt; <br>                        &lt;granite:data <br>                            jcr:primaryType=&quot;nt:unstructured&quot; <br>                            max-items=&quot;8&quot;/&gt; <br>                        &lt;field <br>                            jcr:primaryType=&quot;nt:unstructured&quot; <br>                            sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot; <br>                            cq-msm-lockable=&quot;./cards&quot; <br>                            name=&quot;./cards&quot;&gt; <br>                            &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt; <br>                                &lt;cardHeadline <br>                                    jcr:primaryType=&quot;nt:unstructured&quot; <br>                                    sling:resourceType=&quot;granite/ui/components/coral/foundation/form/textfield&quot; <br>                                    cq-msm-lockable=&quot;./cardHeadline&quot; <br>                                    emptyText=&quot;Card Headline&quot; <br>                                    name=&quot;./cardHeadline&quot; <br>                                    required=&quot;true&quot;/&gt; <br>                                &lt;cardDescription <br>                                    jcr:primaryType=&quot;nt:unstructured&quot; <br>                                    sling:resourceType=&quot;granite/ui/components/coral/foundation/form/textarea&quot; <br>                                    cq-msm-lockable=&quot;./statDescription&quot; <br>                                    emptyText=&quot;Card Description&quot; <br>                                    required=&quot;true&quot; <br>                                    name=&quot;./cardDescription&quot;/&gt; <br>                            &lt;/items&gt; <br>                        &lt;/field&gt; <br>                    &lt;/cards&gt; <br>                &lt;/items&gt; <br>            &lt;/column&gt; <br>        &lt;/items&gt; <br>    &lt;/content&gt; <br>&lt;/jcr:root&gt;</pre><ul><li>Create a sling model to read in the authored data from our component.</li></ul><pre>package com.aem.base.core.models; <br>import org.osgi.annotation.versioning.ConsumerType; <br>import com.adobe.cq.export.json.ComponentExporter; <br>import java.util.List; <br><br>@ConsumerType<br>public interface TwoColumnLayout extends Component, ComponentExporter { <br>    List&lt;StatementCard&gt; getStatementCard(); <br>}</pre><pre>package com.aem.base.core.models; <br>import com.adobe.cq.export.json.ComponentExporter; <br>import org.osgi.annotation.versioning.ConsumerType; <br><br>@ConsumerType <br>public interface StatementCard extends Component, ComponentExporter { <br>    String getTitle(); <br>    String getDescription(); <br>}</pre><pre>@Model (<br>    adaptable = {SlingHttpServletRequest.class}, <br>    adapters = {TwoColumnLayout.class, ComponentExporter.class}, <br>    resourceType = TwoColumnLayoutImpl.RESOURCE_TYPE <br>)<br><br>@Exporter (name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) <br>public class TwoColumnLayoutImpl extends BaseModel implements TwoColumnLayout { <br>   public static final String RESOURCE_TYPE = &quot;aem-base/components/content/two-column-layout&quot;; <br>   @ChildResourceFromRequest (injectionStrategy = InjectionStrategy.OPTIONAL, name = &quot;cards&quot;) <br>   private List&lt;StatementCard&gt; cards; <br><br>   @Override <br>   public List&lt;StatementCard&gt; getStatementCard() { <br>     return cards != null ? Collections.unmodifiableList(cards) : null; <br>  }<br>}</pre><pre>@Model ( <br>   adaptables = {SlingHttpServletRequest.class}, <br>   adapters = {StatementCard.class, ComponentExporter.class} <br>) <br><br>@Exporter (name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) <br>public class StatementCardImpl extends BaseModel implements StatementCard { <br>   @SlingObject (injectionStrategy = InjectionStrategy.OPTIONAL) <br>   private SlingHttpServletRequest slingRequest; <br><br>   @ValueMapValue (injectionStrategy = InjectionStrategy.OPTIONAL) <br>   private String cardHeadline; <br><br>   @ValueMapValue (injectionStrategy = InjectionStrategy.OPTIONAL) <br>   private String cardDescription; <br><br>   @Override <br>   public String getTitle() { <br>     return cardHeadline; <br>   }<br><br>   @Override <br>   public String getDescription() { <br>     return cardDescription; <br>   }<br>}</pre><ul><li>Transition to HTL/ Sightly</li></ul><pre>&lt;div data-sly-use.twoColumnLayoutModel=&quot;com.aem.base.core.models.TwoColumnLayout&quot; <br>data-sly-test.statementCard=&quot;${twoColumnLayoutModel.statementCard}&quot; class=&quot;cmp-two-column-layout__container&quot; id=&quot;${twoColumnLayoutModel.id}&quot;&gt; <br>   &lt;div class=&quot;cmp-two-column-layout-card-headline&quot; data-sly-test=&quot;${item.title}&quot;&gt;${item.title}&lt;/div&gt; <br>&lt;/div&gt;</pre><p><strong>Front-end:</strong></p><p>Developing a two-column layout in front-end development involves creating a visually appealing and functional layout that effectively organizes content into two distinct columns. This approach is commonly used in web design to present information in a structured and visually balanced manner.</p><pre>&lt;div data-sly-use.twoColumnLayoutModel=&quot;com.aem.base.core.models.TwoColumnLayout&quot;<br>    data-sly-test.statementCard=&quot;${twoColumnLayoutModel.statementCard}&quot; class=&quot;cmp-two-column-layout__container&quot;<br>    id=&quot;${twoColumnLayoutModel.id}&quot;&gt;<br>    &lt;ul class=&quot;cmp-two-column-feature-statement-cards&quot; data-sly-list=&quot;${statementCard}&quot;&gt;<br>        &lt;li&gt;<br>            &lt;div class=&quot;cmp-two-column-feature__content&quot;&gt;<br>                &lt;div class=&quot;cmp-two-column-layout-card-headline&quot; data-sly-test=&quot;${item.title}&quot;&gt; ${item.title} &lt;/div&gt;<br>                &lt;div class=&quot;cmp-two-column-layout-card-description&quot; data-sly-test=&quot;${item.description}&quot;&gt;<br>                    ${item.description @ context=&quot;html&quot;} &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/li&gt;<br>    &lt;/ul&gt;<br>&lt;/div&gt;</pre><p>It sets up a structured two-column layout component in Adobe Experience Manager (AEM). It uses Sightly (data-sly-* directives) for dynamic data binding and conditional rendering based on <strong>TwoColumnLayoutModel</strong>.</p><p>The component includes a list that iterates over statementCard items to generate individual cards (&lt;li&gt;) containing title, description, and a link button.</p><ul><li>The &lt;ul&gt; (cmp-two-column-feature-statement-cards) iterates over statementCard, dynamically generating li items.</li><li>Each &lt;li&gt; contains title and description. This content can be customized based on the requirements.</li></ul><p>This setup ensures flexibility and maintainability while leveraging AEM’s component-based architecture for efficient content management and presentation.</p><p><strong>CSS:</strong></p><p>Creating a two-column layout can be achieved in various ways using CSS, each with its own strengths and weaknesses. Here’s a comparison of the different methods: <strong>CSS Grid, Flexbox and CSS Columns.</strong></p><p><strong>Using Flex Layout:</strong></p><pre>.cmp-two-column-layout__container { <br>  padding: 20px; <br>} <br><br>.cmp-two-column-feature-statement-cards { <br>  display: flex; <br>  flex-wrap: wrap; <br>  gap: 20px; /* Space between items */ <br>  margin: 0; <br>  padding: 0; <br>  list-style-type: none; <br>} <br><br>.cmp-two-column-feature-statement-cards li { <br>  flex: 1 1 calc(50% - 20px); /* Two columns with space between */ <br>  box-sizing: border-box; <br>  margin: 0; <br>} <br><br>.cmp-two-column-feature__content { <br>  background: #FFCBA4; <br>  border: 1px solid #ddd; <br>  border-radius: 8px; <br>  padding: 20px; <br>} <br><br>.cmp-two-column-layout-card-headline { <br>  font-size: 18px; <br>  font-weight: bold; <br>  margin-bottom: 10px; <br>} <br><br>.cmp-two-column-layout-card-description { <br>  font-size: 16px; <br>} <br><br>/* Responsive adjustments */ <br>@media (max-width: 768px) { <br>  .cmp-two-column-feature-statement-cards li { <br>    flex: 1 1 100%; /* Single column on smaller screens */ <br>  }<br>}<br><br>@media (max-width: 600px) { <br>  .cmp-two-column-layout__container { <br>    padding: 10px; /* Adjust padding for smaller screens */ <br>  } <br>} </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cpEteBWCNIkQWhc1bBbO_g.png" /></figure><p>Having trouble with CSS Flexbox? Try playing <a href="http://flexboxfroggy.com/">FlexboxFroggy</a> — it’s a fun game that can help you learn it!</p><p><strong>Using Column Layout:</strong></p><pre>.cmp-two-column-layout__container { <br>  padding: 20px; <br>} <br><br>.cmp-two-column-feature-statement-cards { <br>  column-count: 2; /* Two columns */<br>  column-gap: 20px; /* Space between columns */<br>  margin: 0;<br>  padding: 0;<br>  list-style-type: none;<br>}<br><br>.cmp-two-column-feature-statement-cards li { <br>  background: #FFCBA4; <br>  border: 1px solid #ddd; <br>  border-radius: 8px; <br>  padding: 20px; <br>  box-sizing: border-box; <br>  margin-bottom: 20px; /* Space between items */ <br>}<br><br>.cmp-two-column-layout-card-headline { <br>  font-size: 18px; <br>  font-weight: bold; <br>  margin-bottom: 10px; <br>} <br><br>.cmp-two-column-layout-card-description { <br>  font-size: 16px; <br>} <br><br>/* Responsive adjustments */ <br>@media (max-width: 768px) { <br>  .cmp-two-column-feature-statement-cards { <br>    column-count: 1; /* Single column on smaller screens */ <br>  }<br>}<br><br>@media (max-width: 600px) { <br>  .cmp-two-column-layout__container { <br>    padding: 10px; /* Adjust padding for smaller screens */ <br>  } <br>} </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2qs8j8lqlthbf60LXISZA.png" /></figure><p><strong>Using Grid Layout:</strong></p><p><strong>Method #1: CSS Grid</strong></p><pre>body { <br>  margin: 0; <br>  font-family: Arial, sans-serif; <br>} <br><br>.cmp-two-column-layout__container { <br>  padding: 20px; <br>} <br><br>.cmp-two-column-feature-statement-cards { <br>  display: grid; <br>  grid-template-columns: repeat(2, 1fr); /* Two columns */ <br>  gap: 20px; /* Space between columns */<br>  list-style-type: none; <br>  margin: 0; <br>  padding: 0; <br>} <br><br>.cmp-two-column-feature-statement-cards li { <br>  background: #FFCBA4; <br>  border: 1px solid #ddd; <br>  border-radius: 8px; <br>  box-sizing: border-box; <br>  display: flex; <br>  flex-direction: column;<br>  padding: 20px;<br>} <br><br>.cmp-two-column-layout-card-headline { <br>  color: #614051; <br>  font-size: 18px; <br>  font-weight: bold; <br>  margin-bottom: 10px; <br>} <br><br>.cmp-two-column-layout-card-description { <br>  font-size: 16px; <br>} <br><br>/* Responsive adjustments */ <br>@media (max-width: 768px) { <br>  .cmp-two-column-feature-statement-cards { <br>    grid-template-columns: 1fr; /* Single column on smaller screens */ <br>  }<br>}<br><br>@media (max-width: 600px) { <br>  .cmp-two-column-layout__container { <br>    padding: 10px; /* Adjust padding for smaller screens */ <br>  }<br>} </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDFj-dDoq0MSk22-L4zvbg.png" /></figure><p>New to CSS Grid? Explore <a href="https://cssgridgarden.com/">CSSGridGarden</a> — a playful and speedy way to pick it up quickly!</p><p><strong>Method #2: AEM Grid</strong></p><ul><li>In HTML, apply the grid column classes to ensure the list items span the appropriate number of columns:</li></ul><pre>&lt;div data-sly-use.twoColumnLayoutModel=&quot;com.aem.base.core.models.TwoColumnLayout&quot;<br>    data-sly-test.statementCard=&quot;${twoColumnLayoutModel.statementCard}&quot;<br>    class=&quot;cmp-two-column-layout__container aem-Grid&quot;&gt;<br>    &lt;ul class=&quot;cmp-two-column-feature-statement-cards&quot;&gt;<br>        &lt;data-sly-list.items=&quot;${twoColumnLayoutModel.statementCard}&quot;&gt;<br>            &lt;li<br>                class=&quot;cmp-two-column-feature__content aem-Grid-column aem-Grid-column--default--6 aem-Grid-column--phone--12&quot;&gt;<br>                &lt;div class=&quot;cmp-two-column-layout-card-headline&quot; data-sly-test=&quot;${item.title}&quot;&gt; ${item.title} &lt;/div&gt;<br>                &lt;div class=&quot;cmp-two-column-layout-card-description&quot; data-sly-test=&quot;${item.description}&quot;&gt;<br>                    ${item.description @context=&quot;html&quot;} &lt;/div&gt;<br>            &lt;/li&gt;<br>            &lt;/data-sly-list.items&gt;<br>    &lt;/ul&gt;<br>&lt;/div&gt;</pre><p>Define column spans for items in a <a href="https://adobe-marketing-cloud.github.io/aem-responsivegrid/">12-column grid system</a> using CSS setup:</p><ul><li><em>.aem-Grid</em> sets up the grid container using predefined grid mixin.</li><li><em>.aem-Grid-column — default — 6 </em>is used to span 6 out of 12 columns, which creates the two-column layout.</li><li><em>.aem-Grid-column — phone — 12</em> ensures that on smaller screens, the items span the full width (stacked layout).</li></ul><pre>@import (once) &quot;/libs/wcm/foundation/clientlibs/grid/grid_base.less&quot;;<br>@max_col: 12;<br><br>.aem-Grid {<br>    .generate-grid(default, @max_col); /* 12-column grid by default */<br>}<br><br>/* Default column span for grid items */<br>.aem-Grid-column--default--6 {<br>    grid-column: span 6; /* Spans 6 out of 12 columns, creating a two-column layout */<br>}<br><br>@media (max-width: 768px) {<br>    .aem-Grid {<br>        .generate-grid(phone, @max_col);<br>    }<br><br>    .aem-Grid-column--phone--12 {<br>        grid-column: span 12; /* Full width on smaller screens */<br>    }<br>}<br><br>@media (min-width: 769px) and (max-width: 1200px) {<br>    .aem-Grid {<br>        .generate-grid(tablet, @max_col);<br>    }<br><br>    .aem-Grid-column--tablet--6 {<br>        grid-column: span 6;<br>    }<br>}</pre><p>This CSS code snippet defines styles for a two-column layout component in a modular and responsive manner using LESS. It leverages different methods for layout flexibility, incorporates mixins (i.e., @media (max-width: 768px)) for responsive design adjustments and ensures consistent typography and spacing throughout.</p><ul><li><strong>CSS Grid</strong> excels in creating complex, <strong><em>two-dimensional</em></strong> layouts and provides precise control over the placement of items in both rows and columns.</li><li><strong>Flexbox</strong> is ideal for simple, <strong><em>one-dimensional</em></strong> layouts where items need to be aligned or distributed along a row or column.</li><li><strong>CSS Columns</strong> is best for straightforward <strong><em>multi-column</em></strong> text layouts (<strong><em>masonry layout</em></strong>) but lacks the flexibility and control required for more complex layouts.</li></ul><p>Choosing the right method depends on the specific requirements of your layout and the complexity of the design you need to implement.</p><h4><strong>Conclusion</strong></h4><p>AEM’s two-column layout offers a versatile solution for creating compelling web pages. By leveraging its customization options, responsive design capabilities, and seamless integration with AEM’s ecosystem, developers can craft visually appealing and user-friendly experiences that drive business growth in today’s competitive digital landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01699a110cfe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/activate-aem/aems-two-column-layout-for-enhanced-web-development-01699a110cfe">AEM’s Two-Column Layout for Enhanced Web Development</a> was originally published in <a href="https://medium.com/activate-aem">Activate AEM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Responsive Popup Modal in AEM]]></title>
            <link>https://medium.com/activate-aem/how-to-create-a-responsive-popup-modal-in-aem-440eb8df522b?source=rss-9a7e9bccf716------2</link>
            <guid isPermaLink="false">https://medium.com/p/440eb8df522b</guid>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-development]]></category>
            <category><![CDATA[aem-front-end]]></category>
            <category><![CDATA[modal-popups]]></category>
            <category><![CDATA[adobe]]></category>
            <dc:creator><![CDATA[Jenitha Baskaran]]></dc:creator>
            <pubDate>Fri, 08 Mar 2024 06:41:51 GMT</pubDate>
            <atom:updated>2024-03-08T06:46:13.001Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>INTRODUCTION</strong></p><p>A pop-up modal is a descendant window of the primary window of a web application which is also called a dialog. Dialogs can be either modal (content within the dialogue can be interacted) or non-modal (content outside of the dialogue can still be handled).</p><p>Dialogs are placed on top of the rest of the page content using an overlay. When a dialogue element is marked up, assistive technology can recognise that its information is grouped and distinct from the rest of the page.</p><p>The native <strong>&lt;dialog&gt;</strong> element, which has accessibility and usability features, can be used to create pop-up modals. The &lt;dialog&gt; element is exposed by browsers in a manner like custom dialogs that use the <strong>ARIA role=”dialog”</strong> attribute. &lt;dialog&gt; elements invoked by the <strong>showModal()</strong> method implicitly have aria-modal=”true”. The <strong>Esc</strong> key can be used to dismiss a dialogue that the showModal() method invokes by default. By default, a non-modal dialogue does not dismiss using the Esc key, and this behaviour may not be desirable depending on what the non-modal dialogue represents.</p><p>In this article we will explore the popup modal creation within an AEM Application.</p><p><strong>TECHNICAL DETAILS</strong></p><p><strong>Back-end:</strong></p><ul><li>Add a dialogue field that will allow an author to specify the required data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*8UzrxzFCh6zuVblZ" /></figure><ul><li>Create a sling model to read in the authored data from our component.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*9cBp2y9uRiO-fLDP" /></figure><ul><li>Transition to HTL/ Sightly</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GeaZcBDzswgN1gT_" /></figure><p><strong>Front-end:</strong></p><p>HTML 5 is the skeleton of any modern website. As an AEM Developer, you should not only be able to semantically divide pages into sections and style them but leave this apprenticeship making new AEM components with a name-spacing technique called Block, Element, Modifier (BEM).</p><p>BEM is a declarative syntax for naming classes of both HTML and CSS. This technique helps avoid CSS inheritance by assigning a unique class name per component and thus helping to reduce styling conflicts.</p><p>Let’s get started by creating the required HTML markup. All the content within the &lt;dialog&gt; is optional and included for the purposes of this tutorial, you could replace it with whatever content you like in AEM when using this on a real website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*Cjd2g_ba4UIA2Mqb" /></figure><p><strong>HTML:</strong></p><pre>&lt;div class=&quot;cmp-modal-popup&quot; data-sly-use.popupModal=&quot;com.demo.core.models.ModalPopup&quot;&gt;<br>    &lt;button id=&quot;showDialogBtn&quot;&gt;${popupModal.popupButtonLabel}&lt;/button&gt;<br>    &lt;dialog id=&quot;newDialog&quot;&gt;<br>        &lt;form method=&quot;dialog&quot;&gt;<br>            &lt;div class=&quot;cmp-modal-content&quot;&gt;<br>                &lt;div class=&quot;cmp-modal-header&quot;&gt;<br>                    &lt;h3 class=&quot;cmp-modal-header--title&quot;&gt;${popupModal.title}&lt;/h3&gt;<br>                    &lt;button class=&quot;cmp-modal-close&quot; aria-label=&quot;Close&quot;&gt;&amp;times;&lt;/button&gt;<br>                &lt;/div&gt;<br>                &lt;p&gt;${popupModal.description}&lt;/p&gt;<br>                &lt;video controls<br>                    src=&quot;https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4&quot;<br>                    poster=&quot;https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217&quot; width=&quot;620&quot;&gt;<br>                    ${popupModal.videoErrorMessage}&lt;/video&gt;<br>            &lt;/div&gt;<br>        &lt;/form&gt;<br>    &lt;/dialog&gt;<br>&lt;/div&gt;</pre><p>The &lt;dialog&gt; element makes it easy to create popup dialogs and modals on a web page. It represents a modal or non-modal dialog box or another interactive component, such as a dismissable alert, inspector, or sub window.</p><p>HTML &lt;form&gt; elements can be used to close a dialog box if they have the attribute method=”dialog” or if the button is used to submit the form.</p><p>When implementing this on a live website, you can change any of the optional items that are included in the &lt;dialog&gt; with any content that you would like, and all modifiable content and asset links would be entered by an author and supplied to the HTL from the sling model. Additionally, a button (<em>id=”showDialogBtn”</em>) is there to initiate the model’s popup and display.</p><p><strong>CSS:</strong></p><pre> body {<br>   font-family: sans-serif;<br> }<br> button {<br>   font-size: 1rem;<br>   padding: 5px 15px;<br> }<br> dialog::backdrop {<br>   background-color: salmon;<br> }<br> .cmp-modal-content {<br>   background-color: white;<br>   border-radius: 0.5em;<br>   max-width: 900px;<br>   padding: 2em;<br>   margin: auto;<br> }<br> .cmp-modal-header {<br>   display: flex;<br>   align-items: center;<br>   justify-content: space-between;<br>   border-bottom: 2px solid black;<br> }<br> video {<br>   width: 100%;<br> }</pre><p>The<strong> ::backdrop</strong> CSS pseudo-element is a box the size of the viewport, which is rendered immediately beneath any element being presented in the top layer. This pseudo-element could be used to blur, darken, or otherwise obfuscate the inert content behind the modal dialog.</p><p>The modal-content class is a modal content container. The <strong>max-width</strong> property ensures maximum width of responsive modal, no matter how wide the device is. The classic auto value for margins brings the responsive modal to the exact center.</p><p><strong>JavaScript:</strong></p><pre>const showDialogBtn = document.getElementById(&#39;showDialogBtn&#39;);<br>const newDialog = document.getElementById(&#39;newDialog&#39;);<br>showDialogBtn.addEventListener(&#39;click&#39;, () =&gt; newDialog.showModal());</pre><p>The JavaScript functionality will begin with an event listener for user clicks on the open button. The .showModal() method opens the modal dialog when the “Show a dialog” button is activated.</p><p><strong>SUMMARY &amp; BEST PRACTICES</strong></p><p>A user interface element that shows up in the website’s forefront is called a popup modal. Usually activated by the user, they let them access more information or finish an action without requiring them to visit another URL. We built a responsive popup modal with JavaScript functionality and CSS styling in this blog which can be utilised in AEM.</p><ul><li>BEM naming convention</li><li>Block__Element — modifier == cmp-modal-popup__paragraph — text-blue</li><li>Avoid inline CSS or JavaScript</li><li>Keep sections in logical order with header, content, and footer.</li></ul><p>Technical Summary:</p><ul><li>DOM interface: HTMLDialogElement</li><li>As with all HTML elements, it is not conforming to use the <strong>dialog</strong> element when attempting to represent another type of control. For example, context menus, tooltips, and popup list boxes are not dialog boxes, so abusing the dialog element to implement these patterns is incorrect.</li><li>dialog.showModal()<br>- Displays the dialog element and makes it the top-most modal dialog.<br>- This method honors the autofocus attribute.</li></ul><p>Specification: <a href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element">HTML Standard</a> <a href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"># the-dialog-element</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=440eb8df522b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/activate-aem/how-to-create-a-responsive-popup-modal-in-aem-440eb8df522b">How to Create a Responsive Popup Modal in AEM</a> was originally published in <a href="https://medium.com/activate-aem">Activate AEM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>