The future of missing.js #120
geoffrey-eisenbarth
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
missing.js
The goal of missing.js is to provide a comprehensive collection of common UI widgets and behaviors that:
To that end, I am creating this discussion to:
Widget list
Below is a first (and relatively unranked) draft of the widget list; suggestions for additions are greatly appreciated. Names and rankings are subject to change, please speak up if you feel like either should be change and I'll happily edit this post. Once we feel like we have a good list going, we can chunk it up into milestones and open GH issues for them.
ARIA APG Patterns (click to toggle)
<datalist>
, support chip input c.f. franken ui)Non-APG Patterns (click to toggle)
.titlebar
in alerts, dialogs, etc)<progress>
, but if we wanted to display percentage values, might require more)a) is
<input type=date|time|datetime-local>
sufficient?b) support non-Gregorian calendars, localization support
c) date range picker (e.g. booking a hotel)
<input type=color>
sufficient?)For completeness, here is a list of the remaining ARIA APG Patterns that either have good or partial native HTML support. It should be determined if we want to add implementations of any of them:
Remaining ARIA APG Patterns (click to toggle)
<details name>
<div role=alert>
. Are there other impl details that make this worth promoting? What aboutrole=status
androle=alertdialog
? Are these different from "toasts" in any ways?<dialog role=alertdialog>
? Implicit role of<dialog>
isrole=dialog
.a) place it inside a
<nav>
b) give it an accessible name
c) set
aria-current=page
if the element representing the current page is a linkd) note: there is no
role=breadcrumb
e) note: earlier proposal suggested that each “crumb” can open a menu that shows other items on that level of the hierarchy
<button>
<input type=checkbox>
<dialog>
<details>
<aside>
,<footer>
,<header>
,<main>
,<nav>
,<section aria-label>
,<form>
, and<search>
<a>
<meter>
<input type=radio name>
<input type=range>
<input type=number>
. I'm a little iffy on this, doestype=number
sufficiently cover the pattern? Looking at the APG example, it seems like not.<input type=checkbox role=switch>
. As of writing, this requires significant CSS in order to style as a switch.<table>
Naming conventions
Thanks to deniz, we have two great utility functions for creating behaviors and custom elements. The following is a list of considerations that I think should be nailed down for a large number of the use cases above before implementations are started:
role
attribute. Probably more compatible with existing alternative CSS solutionsaria-tablist
,aria-tab
,aria-tabpane
,aria-feed
,aria-menubar
,aria-menu
,aria-menu-item
, but how robust is this?aria-tooltip
,aria-carousel
,aria-tree-view|grid
,aria-window-splitter
<a-tablist>
,<a-menubar>
, maybe<an-alert>
?aria-
prefix seems a little out of place for non-APG patterns:<aria-input-mask>
/<aria-scroll-box>
(but<an-input-mask>
and<a-scroll-box>
could work).<missing-input-mask>
too long? and 2) I'm not crazy about any abbreviations to "missing".CSS implementation
Our goal is to allow anyone to style these widgets. How can we best facilitate that?
No other library is going to have existing CSS rules for e.g.
<aria-tab>
, whereas they might have rules for<li role=tab>
. Do we care about this? Is there something we can do about this, or is it enough to say "we have provided basic styles with plenty of CSS vars for hooking in your own styles, and you're free to write your own style sheets?The default CSS
display
value for custom elements isinline
, which is at odds with e.g.<aria-tabpanel>
which needs to bedisplay: block
. In order to set this in a CSS framework agnostic way, we'd have to set it in the Shadow DOM (which imo is okay). Are there any issues with setting a few very simple CSS styles in the shadow DOM?)JS implementation
Components should mutate their child elements as little as possible. They should be able to initialize themselves when the children have already been mutated (i.e. if a live DOM tree is stringified and restored, such as during htmx history restoration).
Components should emit events liberally for interactions performed on them, so that their behavior can be hooked into.
Styles (that are not strictly required for functionality) should be published in a CSS style sheet (rather than being embedded in the component, or requiring a dependency like Tailwind). The components should be fully usable without the style sheet, i.e. users should be able to write their own style sheets instead.
Use of Shadow DOM should be avoided, completely if possible. This is to avoid problems in integrating with other libraries, particularly htmx.
tag()
: the cornerstoneCreation of custom elements is facilitated by the excellent
tag()
function that deniz recently put together. A few thoughts that might help us avoid some more boilerplate:connectedMoveCallback()
andadoptedCallback()
MutationObserver
support to theoptions
param? Maybe:focusGroup
commandfor
andcommand
attributes:<aria-menuitem commandfor="text-selection" command="--bold-text">
.--bold-text
event on#text-selection
if (typeof CommandEvent === "function" )
and callback to regular EventsSome other potential base behaviors mentioned by deniz in a previous iteration of this concept. Including them here for the sake of completeness, but we should determine where they fit in the larger picture and if they're still beneficial.
Next steps
I think that covers all my initial thoughts on this matter. As for next steps:
Once a naming convention is decided upon and the list of widgets is ordered and settled, I will put together demo pages for every widget so that the syntax can be finalized and we can have something to (manually) test against during development. We will need to decide if this should be a separate branch or just added to
dev
. Is it possible to hide certain demos from the public docs as releases go out, or should we just add "Under Construction" GIFs?We need to figure out a graceful way to deprecate the existing behaviors (or not?)
Looking forward to getting my hands dirty!
Beta Was this translation helpful? Give feedback.
All reactions