Skip to content

New Approach for Popup #455

@mfreed7

Description

@mfreed7

There has been extensive debate (e.g. #410 and #417, plus numerous OpenUI meeting discussions) about the <popup> element proposal. That proposal got "stuck" on what appear to be some rather fundamental questions about the semantics and associated AX roles for this new element.

As a result of these issues, we've put together a fresh proposal for a new way to achieve (roughly) the same list of goals. This new proposal introduces an HTML attribute syntax that allows any element to be made into a "popup" that gets rendered on top of all other page content:

<div popup=popup>I'm rendered on top!</div>

Here, the popup attribute is set to a value of popup (other values include hint and async) to indicate "popup" behaviors should be applied. That includes:

  • Rendering in the top layer
  • Automatically-provided light-dismiss and one-at-a-time behavior. (These depend on the value of the popup attribute.)
  • Accessible by default

Additionally, another HTML attribute, triggerpopup, can be used for declarative triggering, so that this API can be used without any JavaScript required:

<button id=picker-button triggerpopup=datepicker>Pick a date</button> 
<my-date-picker role=dialog id=datepicker popup=popup hidden>
  ...date picker implementation...
</my-date-picker>

In this case, the <my-date-picker> component starts out hidden, but when the <button> is clicked, the UA removes hidden from <my-date-picker> and the date picker is shown. As with all popups, once the user clicks outside, hits Esc, etc., the UA will light-dismiss it by adding back the hidden attribute.

Please take a look at the new proposal, and add your comments here to this issue. Pull requests for changes are also great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    popoverThe Popover API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions