Skip to content

Avoid Interactive Children #29

Open
@aardrian

Description

@aardrian

Looking back through the readme, I see the following:

More complex toasts, that don't fit the above content model, would require more custom handling on the part of the developer:

<std-toast>
  <p>Hello world!</p>
  <p>A second paragraph?!</p>

  <button>Action 1</button>
  <button>Action 2</button>
</std-toast>

That behavior is a dialog, not a toast.

Note that the ARIA roles I have identified in #25 (Map to Existing Roles) generally do not have interactive controls within them (other than to dismiss). They are informational.

Those roles generally do not receive focus when they appear nor should they. Adding interactive controls creates a more complex challenge, especially as I see other issues discussing where a toast should live in the DOM.

Anywhere in the DOM you place a toast that holds interactive controls will likely create both a reading order (1.3.2 Meaningful Sequence) and focus order (2.4.3 Focus Order) WCAG failure on a page/screen. At least not without a lot of native focus management supplemented by author focus management. We already know how difficult that is given the problems with native <dialog> implementations in browsers.

If the toast has a built in time limit before it disappears, then adding interactive controls means the browser must also provide a way, via settings, to override that time limit. Otherwise it will create 2.2.1 Timing Adjustable challenges for authors and users.

To recap, allowing toasts to contain interactive controls puts the burden on the user agent to:

  • handle all the focus management
  • provide a UI for users to adjust timing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions