Skip to content

[Notification/Message] Defining component behaviour #400

Closed

Description

@andrico1234

Naming things is hard
--Everyone, probably

We've had some great discussion and input in this issue focused on naming the toast/notification/message component.

What's blocking progress, and I'm not the only one who feels this way, is the lack of a definition for the component's behaviour. We can't make an informed decision around what to call this component if we don't have a general idea about what it does.

Judging from the issue, there are two broad definitions.

For the sake of this issue I've given them names and described behaviours but nothing is confirmed, everything is still up for conversation.

Convenience wrapper for live region

Used as a convenience wrapper around a number of live region roles, like alert, status, and log. The proposal draft has a bit more context around this.

I might be wrong here, but going with this implementation could mean little/no change around interaction behaviour.

A benefit to this approach is improved usability for those using assistive technologies.

A concern brought up in the std-toast discourse, is that the onus for implementing an accessible interaction still lies on library authors and frontend developers.

Time-sensitive and non-disruptive notice

This kind of behaviour would fall more in line with what we associate as a notification, alert, or toast. This is the kind of implementation I had in mind when proposing this component. I proposed it because there are a lot of similar implementations out there from developers roll on their own, or use via component libraries.

In short:

A time-sensitive and non-disruptive notice to let the user know of a change in the application's state.

Yinonov describes similar behaviour in the issue.

This is the kind of behaviour that's described in the component matrix as alert, toast, notification.

Off the bat, a component like this offers up dilemmas around dismissing interactivity and default styling in relation to the document flow.

Other

Are there any other possible definitions for behaviour that I've missed out? I'll be happy to add them to my list.

I've expressed the options I had in mind when proposing this component, but am not tied to the notice implementation. I'm willing to go with whichever option we believe would provide the most benefit to the web.

Activity

  1. changed the title [-][Toast/Notification/Message] Defining component behaviour[/-] [+][Notification/Message] Defining component behaviour[/+] on Sep 6, 2021
  2. andrico1234 commented on Sep 6, 2021

    @andrico1234
    CollaboratorAuthor

    I'm hoping I can take this to next week's Telecon

  3. yinonov commented on Sep 7, 2021

    @yinonov

    laying out few key points

    • Interaction - is it possible to have action buttons toggled by authors? so that it can act as both toast & snackbar, there's also a legacy web differentiation named alert & prompt (it IS being deprecated so maybe shouldn't be aligned with)
    • Stacking - single instance at a time? some libraries stack multiple notifications
    • Positioning - customizable? a predefined set of positions? browser defined?
  4. andrico1234 commented on Sep 7, 2021

    @andrico1234
    CollaboratorAuthor

    I'd like to not focus too much into interaction specifics (though these are all valid questions and I'll add them to the proposal draft), but more a question on the scope of behaviour,

    I.e. should the Notification/Message be a convenience wrapper around aria roles, or should kt be a standardized implementation of similar components like Ant's message

    My bad, i should've been more explicit in the initial issue message!

  5. chrisdholt commented on Sep 7, 2021

    @chrisdholt
    Collaborator

    I think the key here to defining behavior is to understand what the right role is for this control. As I mentioned on another thread or issue, the fundamental question is whether or not the control can/will include interactive elements. Certain roles permit interactive content while others do not; understanding the intent behind these roles are key to understanding how all users will interact with a given control. Just because things look similar, are common, or exist across design systems (toast, snackbar) doesn't mean they are 1) a good, accessible pattern, 2) the same implementation.

    alert - "Because alerts are intended to provide important and potentially time-sensitive information without interfering with the user's ability to continue working, it is crucial they do not affect keyboard focus." If the plan is to support interactive elements within the "toast", then alert is likely not the ideal underlying role or pattern. If we determine that toasts should not include interactive content, this is likely a fine candidate for the element role itself.

    alertdialog- "An alert dialog is a modal dialog that interrupts the user's workflow to communicate an important message and acquire a response. Examples include action confirmation prompts and error message confirmations." I don't think every toast would fall into this category.

    dialog - Dialogs may contain interactive content. Dialogs may or may not be modal.

    Tagging @gregwhitworth as this pertains to his comment here. I'm not sure that dialog is the best implementation for every toast, nor do I think it's necessarily the right name. My thought is that depending on requirements, this may be best accomplished as a pattern and/or guidance. If we can align on this only containing non-interactive content, then the alert role is fine and we can move on with naming given that context. However, if we believe that something like toast and snackbar are basically the same with exception that one includes interactive content, I think we should reconsider if this is best accomplished as a component or a pattern/guidance. Popup provides all hooks necessary to support the visual appearance and behavior of this from a positioning/elevation standpoint, while leaving open the ability to support any of the above roles based on the content model. In the case that the content model needs to support both text-only and interactive content, is it reasonable to consider that as an option here?

  6. aardrian commented on Sep 7, 2021

    @aardrian

    This may be redundant to all participants, but I want to bring over what I think should be a starting point from the previous toast discussions — identifying how this is exposed to existing accessibility APIs. Otherwise we risk specifying something that cannot be implemented by devs because it has no accessibility affordances in browsers or AT.

    To reprint my 2019 comment about mapping to existing roles:

    ARIA 1.2 contains roles that do not have native HTML counterparts, as outlined in 2.14 Aria roles and properties not available as features in HTML. A collection of roles that may apply to this proposal:

    Each of these roles identifies how it is exposed to the accessibility APIs and what states and properties they should expose.

    For any of these roles that you feel applies to the proposed toast element, then you may want to mint attributes to indicate which (eg: type="alert|status|timer") and their associated ARIA states & properties (eg: live="polite|assertive" and/or atomic="true|false" and/or …).

    At the very least, a native toast implementation should look to adopt one or more of these roles and follow the interactions already defined in the ARIA specification.

    Where alert and status seemed to be the most straightforward fit.

    Limiting to those roles also helped move along the conversation around the issue Avoid Interactive Children.

  7. chrisdholt commented on Sep 7, 2021

    @chrisdholt
    Collaborator

    This may be redundant to all participants, but I want to bring over what I think should be a starting point from the previous toast discussions — identifying how this is exposed to existing accessibility APIs. Otherwise we risk specifying something that cannot be implemented by devs because it has no accessibility affordances in browsers or AT.

    I like to think this enhances my note above :). Thanks for posting.

  8. andrico1234 commented on Sep 7, 2021

    @andrico1234
    CollaboratorAuthor

    Cheers folks! I'm in agreement with @aardrian that alert and status seem like appropriate starting points. I think you both better expressed what I had in mind as the Time-sensitive and non-disruptive notice, which sounds like a standardised implementation of the alert role.

  9. added
    agenda+
    on Sep 14, 2021
  10. travisleithead commented on Sep 20, 2021

    @travisleithead
    Collaborator

    Hmm. Just saw this and wondered to what extent it might overlap with https://wicg.github.io/aom/notification-api.html? (Geared specifically toward assistive technology users.)

  11. andrico1234 commented on Sep 21, 2021

    @andrico1234
    CollaboratorAuthor

    Thanks for sharing @travisleithead 😄

    We haven't quite settled on the behaviour for this Notification/Message element, so I'm reluctant to speak too much about the possible crossover. If the Notification/Alert proposal doc was more mature, I'd suggest we look to see where they may be overlap. Saying that, we're due to discuss Notification/Message behaviour in an upcoming Telecon.

    Based on the most recent messages though, it seems like we're converging around a UI component for the alert role. And looking at the Notification API's proposed solution, it seems like an alternative to displaying notifications in the UI. Like the "Selected text is now glowing blue" example

    For use cases that don’t have an express UI tie-in, it makes sense to provide a solution not expressly tied to HTML element, but for which other document-centric information can be inferred (such as language).

    That could suggest the problem space may benefit from both solutions

  12. css-meeting-bot commented on Sep 23, 2021

    @css-meeting-bot

    The Open UI Community Group just discussed [Notification/Message] Defining component behaviour, and agreed to the following:

    • RESOLVED: stage 0 of alert as separate component
    The full IRC log of that discussion <gregwhitworth> Topic: [Notification/Message] Defining component behaviour
    <gregwhitworth> github: https://github.com//issues/400
    <melanierichards> andrico1234: a few weeks back, we graduated a notification/message/alert/toast proposal to stage 0. Under the reqs we need to choose an appropriate name. std-toast was contentious, it's a name not all are familiar with. The pattern/impl is different across design systems
    <melanierichards> andrico1234: opened disc to think about appropriate name. We didn't have a broad definition of the behavior, so can't choose a name. So opened up the current issue and had a good disc from a number of people about behavior. Converged around impl around an existing aria role, like alert or status
    <melanierichards> andrico1234: based on [missed]'s comment, the proposal is most close to an alert role. My question I'd like resolved, can we create an implementation for the alert ARIA role?
    <gregwhitworth> q?
    <melanierichards> andrico1234: can add more context, I know there was difficulty distinguishing between alert dialog and popup? Maybe worth covering?
    <melanierichards> melanierichards: I was not here for it but it would be good to cover points of confusion
    <melanierichards> andrico1234: Google alert disruption was top of mind, requires an action, but for alert should be no interactive children
    <gregwhitworth> melanierichards: from my pov, it seems like alert could be a subclass of popup
    <gregwhitworth> melanierichards: I'm going to guess the light dismiss behaviors are different
    <gregwhitworth> melanierichards: that is distinguishing factore
    <gregwhitworth> melanierichards: alerts shouldn't have interactive children
    <gregwhitworth> q+
    <gregwhitworth> melanierichards: it seems like having something like this in HTML is worthwhile
    <melanierichards> gregwhitworth: my biggest qualm, and it's alignment with Melanie to an extent, I do feel that if you look at scenario you ref with alert/confirm/etc, there's subclasses of alerts w/ different interactive models, they popup for different contextual reasons. I don't think it's good to have all statuses/alerts/etc becoming alerts...should be some root foo that does the popping up. Maybe it's <popup> and light dismissal becomes a
    <melanierichards> primitive. Rarely would you use message...more alert, confirm, etc. Windows leverages the same message scheme, they show up in the same spot, one might have a confirm and one might have an action.
    <melanierichards> gregwhitworth: personally I like a base class of something. I don't think everything is technically an alert.
    <flackr> q+
    <melanierichards> andrico1234: would you suggest something like creating a component that we would then give the person implementing the component the ability to specify something more specific via an attr? And they would worry more about the impl themselves? So if it's an alert wouldn't do anything w/ focus mgmt, but if it's a confirm they make decision themselves about focus mgmt
    <melanierichards> gregwhitworth: totally up to debate about we reuse <popup> or not. But let's say we have a new thing called <message>. Would expect <alert>, <confirm>, <prompt> component. Wouldn't want to just provide container and force dev to figure out focus trapping.
    <melanierichards> gregwhitworth: expect 3-4 components to use a base class, pop up over all content, there can be many of me, and so on
    <flackr> q-
    <melanierichards> gregwhitworth: so maybe let's start with <message>...but there should be a convo of should that be <popup>? I think we shouldn't encourage to use message since it's just generic
    <melanierichards> q+
    <melanierichards> gregwhitworth: would be in favor of making <popup> this top-level component and just making lightdismiss a primitive
    <gregwhitworth> ack gregwhitworth
    <masonf> q+
    <gregwhitworth> ack melanierichards
    <gregwhitworth> melanierichards: I am aligned with you in the spirit of not making everything an alert
    <gregwhitworth> melanierichards: I think I disagree with making popup the base class for that
    <gregwhitworth> melanierichards: there is a specific content model and light dismiss and mutual exclusivity
    <gregwhitworth> melanierichards: we wouldn't use that for message for example
    <gregwhitworth> melanierichards: I don't necessarily have THE solution
    <gregwhitworth> melanierichards: a whole ton of new components
    <gregwhitworth> melanierichards: if anything - dialog is actually closer to something that is built on top of
    <gregwhitworth> ack masonf
    <gregwhitworth> melanierichards: I was going to say the same thing as melanierichards
    <gregwhitworth> melanierichards: light dismiss probably doesn't apply
    <gregwhitworth> melanierichards: all of those work just as well with dialog
    <melanierichards> masonf: pretty much same thing, all of these use cases sound much closer to dialog than popup. Light dismiss doesn't apply, having only one doesn't apply here, all of these work for dialog so maybe the base class is dialog
    <melanierichards> gregwhitworth: ok maybe good next steps, I don't hear any drastic disagreements
    <melanierichards> gregwhitworth: one concern w/ dialog, and everyone knows it, historical baggage with that. That doesn't stop us from doing it. Andrico I'd probably recommend starting from there. Pursue alert component starting from dialog. We can loop in Domenic, spec editor for dialog. I can see the intro being this builds on top of dialog, adding more constraints on top of it.
    <melanierichards> masonf: it's just a shell, a div you can fill up. Some styling rules.
    <masonf> q+
    <melanierichards> gregwhitworth: I could see you saying it extends dialog element. And then you have your OUI component, here's what can be included, ARIA role adjustments. Doesn't have to be a long doc, light dismiss handled by dialog. The other thing we'll have to handle is mods done to popup for initial rendering, rendering w/o JS
    <melanierichards> gregwhitworth: any disagreements to pivoting to individual components built on top of dialog rather than one-size-fits-all?
    <gregwhitworth> ack masonf
    <melanierichards> masonf: I'm not even sure any other el in the HTML spec uses a concept of a base class or element. They are defined independently. Maybe that's the way to handle this. Define how it behaves itself.
    <melanierichards> q+
    <melanierichards> gregwhitworth: we could dupe the light dismiss behavior. Andrico, would you want to own the entire thing inside an alert modal? Given Mason's comments, maybe want to triculate behaviors or pull them out? I think reused behaviors are pulled out?
    <melanierichards> masonf: yes, you can reuse. I don't know of els that say, I'm this element with other stuff
    <melanierichards> flackr: I did some code searches, I see subclasses of div element. output a subclass of form element. [some other examples]
    <melanierichards> masonf: in impl, you're correct. Not sure about spec land
    <melanierichards> flackr: spec land does specify some of those relationships
    <melanierichards> andrico1234: think this would be a good start. Anything more complex probably beyond my capabilities as web dev. Don't have as much experience w/ underlying web tech. But for impl a base class that we can then extend, that might be something I can't quite...
    <melanierichards> gregwhitworth: they're great resources to utilize, but don't worry about how they're implemented. You're authoring a spec and we're here to help. Rob, if you can @ mention Andrico in Discord where WHATWG specifies that, so that if we want to say extend dialog we can start there
    <melanierichards> gregwhitworth: one thing to note, while people were strong on name, landing a stage 0 spec proposal does not limit us from changing the name down the road. We can argue about names for next 20 years. Would move forward with getting initial alert proposal going.
    <gregwhitworth> melanierichards: I don't have pushback
    <gregwhitworth> melanierichards: I thought we wanted to make a proposal that would land in the web platform
    <gregwhitworth> melanierichards: if that doesn't happen we're happy with folks having a WC
    <gregwhitworth> q?
    <gregwhitworth> ack melanierichards
    <gregwhitworth> q+
    <melanierichards> andrico1234: was talking about moving to a world where we don't need to use ARIA roles. So maybe that would make this land in HTML spec and not as an OUI component
    <masonf> Example of spec base class usage: HTMLAudioElement extends HTMLMediaElement: https://html.spec.whatwg.org/#htmlaudioelement
    <nicole> +1 to Greg: we should land as much as we can in WhatWG
    <melanierichards> gregwhitworth: to be blunt, I have every expectation this would land as a new element in WHATWG. I have yet to see us talk about a component that would land in HTML spec. Convo justifies separate components. Any opposition?
    <nicole> queue+
    <melanierichards> RESOLVED: stage 0 of alert as separate component
  13. andrico1234 commented on Sep 23, 2021

    @andrico1234
    CollaboratorAuthor

    Based on the Telecon resolution, we're going ahead with an alert component with the expectation that it will land as an element in the HTML spec. I'll close this issue and continue work on the Stage 0 proposal for Alert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agenda+

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions