Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

readme.md

Willow-Dialog

Demo

Willow-Dialog is a small window that overlays (pops up over) the content of a webpage. Dialogs communicate information to a user and can prompt them with questions that do not require a response. If any of your questions require an answer use the willow-modal component instead. The dialog should disappear if the user has completed the task or action, pressed the esc key, or clicked outside of the dialog.

Examples: errors, warnings, to collect data, to inform users of important information, to provide opt-in options like email signup


Willow Dialog vs Willow Modal

Dialog Modal
Contains a Message Contains a Message
Can Contain an Action or Question Must Contain an Action or Question
Does Not Require Action or Answer Requires Action or Answer
Multiple Ways to Close Window Action or Answer Required to Close Window

HTML Snippet

<div class="willow-dialog">
    <section class="willow-dialog__container" role="dialog">
        <h1 class="willow-dialog__heading">Heading Text</h1>
        <div class="willow-dialog__content">
            <!-- insert content components here-->
        </div>
        <ul class="willow-dialog__actions">
            <li class="willow-dialog__action"><!-- insert action component here --></li>
        </ul>
    </section>
</div>

Elements

willow-dialog

  • Required
  • Restrictions
    • Should Contain: the willow-dialog__container element

States

<section class="willow-dialog" data-dialog-close="true"> : closes the dialog

Notes

  • willow-dialog produces a semi-transparent overlay over the page content to help a user focus on the dialog and to stop interaction with the page until the user closes the dialog
  • the willow-dialog should close when a user clicks outside of the willow-dialog__container element
  • pressing the esc key on the keyboard should trigger the willow-dialog to close

willow-dialog__container

  • Required
  • Restrictions
    • Should Contain: dialog content elements (__heading, __content, and __actions)

Notes

  • willow-dialog__container contains all content and action based items for the dialog
  • clicking outside of the willow-dialog__container window should trigger the willow-dialog to close
  • The use of role="dialog" with the <section> element ensures that willow-dialog__container is accessible for user agents that do not support HTML5. The use of both <section> and <role="dialog"> together may create a warning in an HTML validator but we left this pattern intact for now to cover all of our accessibility bases.

willow-dialog__heading

  • Required
  • Restrictions
    • Should Contain: text

Notes

  • willow-dialog__heading is visible by default, and even if it is hidden, it is required to meet accessibility standards
  • To hide the willow-dialog__heading add the sr-only utility class to the element

willow-dialog__content

  • Required
  • Restrictions
    • Should Contain: one or more components

willow-dialog__actions

  • Optional
  • Restrictions
    • Should Contain: one or more willow-dialog__action elements

willow-dialog__action

  • Optional
  • Repeatable
  • Restrictions
    • Should Contain: one actionable component (such as willow-button or a link)

Notes

  • completing the actionable component should record the response and trigger the willow-dialog to close