Skip to content

[popup] Note that popup=async + JavaScript allows custom behavior #495

Closed

Description

@mfreed7

This issue was reported by @domenic here, and is being moved to the OpenUI repo.


This was a nice bonus I discovered upon reflection, and comparing with the old popup proposal.

If a developer wants some sort of custom behavior, e.g., "close all other toasts that are of a similar application-specific type", or "no force-close but yes light dismiss", then they can accomplish it using popup=async plus some custom JavaScript code for the entertoplayer handler.

This is good! It counters any arguments that, by providing somewhat-opinionated classes of UI, we're doing something too magic that will make developers sad.

I think this is worth pointing out in https://github.com/mfreed7/popup#classes-of-ui---dismiss-behavior-and-interactions .

(Also it may feed into the bikeshed discussion, e.g. popup=manual might be a better name than popup=async.)

Activity

  1. added
    popover
    on Mar 24, 2022
  2. gregwhitworth commented on May 3, 2022

    @gregwhitworth
    Member

    @mfreed7 is the sole purpose of this to be a reminder for you to add a positive note to the spec regarding this?

  3. mfreed7 commented on May 4, 2022

    @mfreed7
    CollaboratorAuthor

    I think this warrants some discussion, actually. I was discussing this with @una today, and we came to the conclusion that <div popup=async> and <dialog>.show() behave very similarly:

    • Both stay open until explicitly closed.
    • Both allow multiple elements to remain open at the same time.
    • Both are typically (?) used for UI that is akin to an alert that doesn't need immediate action, in contrast to a modal dialog or a transient popup, for example.

    There are some differences:

    • non-modal <dialog> is not top layer, while <div popup=async> is.
    • <dialog> has role=dialog semantics, while <element popup=*> has the semantics/a11y role of <element>.
    • <dialog> has no open event, while popups do have a show event. This allows the "customizability" described in the OP here.

    The above begs the question: do we need both? Are these two things (non-modal dialog and async popup) close enough that we shouldn't introduce both? Or are the differences both a) useful enough, and b) not too confusing, such that we should ship both.

    Side note: I really like the suggestion to rename popup=async to popup=manual. It is more descriptive, I think. It would also give another suggestion for the bikeshedding issue for popup=popup: popup=auto.

  4. chrisdholt commented on May 4, 2022

    @chrisdholt
    Collaborator

    @mfreed7 it seems like the underlying question here is, "Are all instances of popup=async instances of a non-modal dialog"? If they are, then that provides an answer - but if they aren't, are we getting into territory of running into scenarios where semantics are being overridden on dialog to accomplish something? And in that case, would we then be running afoul of the reason we moved away from <popup> as an element? I don't know that I have an explicit answer there myself, but I am naturally a bit dubious (without examples of course...) that dialog semantics would always fit or apply here.

  5. scottaohara commented on May 4, 2022

    @scottaohara
    Collaborator

    agreed. we are verging on discussing what toasts-like notifications should be marked up as without discussing them directly. are hey non-modal dialogs? are they non-modal dialogs which have also been marked as popups to get them in the top layer? are they something else entirely?

    Note: there are also a variety of open questions / spec-gaps for non-modal dialog which may further diverge these two concepts. so what a non-modal dialog behaves like now is not necessarily how it should be behaving

  6. mfreed7 commented on May 25, 2022

    @mfreed7
    CollaboratorAuthor

    After a discussion with @aleventhal, and based on the comments above, it seems increasingly clear that there are really only two use cases currently being discussed for popup=async:

    1. notifications/alerts/toasts/snackbars (all different names for roughly the same use case)
    2. "Everything else"

    Since the "everything else" use case is rather nebulous, it becomes tough to design things like accessibility. We were wondering if it might make sense to rename popup=async to popup=alert (as it was decided here, or we could choose one of the other names) and make this use case more explicitly for notifications/alerts/toasts/snackbars. That would allow us to define more precisely the accessibility expectations. E.g. should they all be announced? Should they all be landmarks?

    Given our previous IDL resolution, the available values for the popup attribute are feature-detectable. So we can always come back and create additional values to support additional use cases in the future, as they become apparent. But for now, let's scope this to the one concrete use case. Thoughts?

  7. domenic commented on May 25, 2022

    @domenic
    Contributor

    TOAST

  8. chrisdholt commented on May 25, 2022

    @chrisdholt
    Collaborator

    TOAST

    I could see alert implying a relationship with a11y and the role of the same name. Inferring a bit from @domenic's "vote" (?), toast may be more desirable here if we are looking at managing expectations around accessibility and aren't going to directly tie this to the alert role. ¯_(ツ)_/¯

  9. domenic commented on May 25, 2022

    @domenic
    Contributor

    I was mostly being silly, please ignore!

  10. chrisdholt commented on May 25, 2022

    @chrisdholt
    Collaborator

    I was mostly being silly, please ignore!

    Noted! I'll stand by the potential implication of having a name that also represents an intuitive role here. I know we were hesitant to tie popup to role so I think it's worth consideration. FWIW, I'm not a fan of names like "toast" or "snackbar" but in this case I'd take the first over the last myself :)

  11. scottaohara commented on May 25, 2022

    @scottaohara
    Collaborator

    i think the thing we need to keep in mind if we go this direction, we take into account it was previously decided that there could be multiple of these on a page at once, on page load even. if they all have the potential to be individual live region elements, that could create A LOT of dynamic announcements.

    Live regions competing with each other (when multiple are declared and fired at the same time on a web page) resulting in having their announcements overwritten by each other, or accidentally cancelled out by users is unfortunately common.

    As I mentioned in the other doc we were working on (so i'm not going to repeat myself here for now), i'm not opposed to going this way with the attribute value. I would just want to tread carefully.

    re: the potential new attribute name. i'd submit we should have another naming discussion on that (everyone's favorite thing to do, i realize). A lot of things have changed since that resolution.

    However, if we codify the image of toast that domenic posted into an emoji that could be used as the attribute's value... then i rescind that statement, and we absolutely should just make the value 'toast emoji' (of which i could not easily find one in my 3 minutes of looking)

    <div popup=🍞> a loaf of bread is just a lot of future toast, right?</div>
    
  12. aleventhal commented on May 26, 2022

    @aleventhal

    No matter how hard we try, this may be something the author needs to at least think about.

    How about this: we support both popup=async and popup=notification.
    They will do the same thing except that popup=notification will be exposed as an alert or alertdialog.
    Benefits:

    • The name "notification" would attract authors who are using it for that. In most cases notifications should be announced, so this would provide the best default behavior.
    • The name "async" would attract authors who need the functionality but don't think of their dialog as a notification.

    There is no perfect solution, but if we can be 80% right that would be great.
    The spec can explain the difference. Having the 2 different values would encourage authors reading about it or blogging about it to explain the difference. In short, we get the best behavior we can by default, make it easy to change, and show that it's a decision point worth thinking about.

  13. scottaohara commented on May 26, 2022

    @scottaohara
    Collaborator

    i like that @aleventhal

  14. aleventhal commented on May 27, 2022

    @aleventhal

    I wonder if it's preferable to have an element, like <notification>, because it could come with a close button and Escape-to-close behavior, "for free".

  15. scottaohara commented on May 27, 2022

    @scottaohara
    Collaborator

    i absolutely think that's the preferable end goal. if something like a <notification> or <message> ... or even <tooltip> existed, then those would be what developers would/should (hopefully) reach for.

  16. 19 remaining items

  17. mfreed7 commented on Jun 23, 2022

    @mfreed7
    CollaboratorAuthor

    I'm not sure minutes are going to get posted, but just in case they don't, here is a copy:

    https://www.w3.org/2022/06/23-openui-minutes.html#t02

    RESOLUTION: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.

    Based on that resolution, I'm going to close this issue. Hopefully the real minutes get posted soon.

  18. css-meeting-bot commented on Jun 23, 2022

    @css-meeting-bot

    The Open UI Community Group just discussed [popup] Note that popup=async + JavaScript allows custom behavior, and agreed to the following:

    • RESOLVED: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.
    • RESOLVED: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.
    The full IRC log of that discussion <gregwhitworth> Topic: [popup] Note that popup=async + JavaScript allows custom behavior
    <gregwhitworth> github: https://github.com//issues/495
    <andrico1234> masonf: take it as an action to spin up issue about default styles
    <andrico1234> masonf: we've talked about this issue. does popup attributes affect semantics. popup attribute only describes behaviour. all of it is behaviour, none of it is semantics. side thing, popup async to popup=manual
    <andrico1234> masonf: aligns more with popup=auto, it feels parallel and easier to understand
    <andrico1234> masonf: a side issue with renaming popup=hint, but a separate issue. last thing is not part of resolution. phase 1 is what we've talked about with 3 values. phase 2 is to define actual elements for some of these usecases with these semantics, like tooltips and notification
    <andrico1234> masonf: use these values, but semantic elements with base styles
    <masonf> Proposed resolution: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility). Also rename popup=async to popup=manual.
    <gregwhitworth> q?
    <dandclark> q+ to agree
    <gregwhitworth> ack dandclark
    <Zakim> dandclark, you wanted to agree
    <gregwhitworth> +1 to the proposal, I don't need to rehash my opinion
    <andrico1234> dandclark: i agree with these points. we had long conversations about defining semantics for popups as they're used for so many things. feels right to not add semantic baggage. also manual seems reasonable
    <una> q?
    <JonathanNeal> q+
    <gregwhitworth> ack JonathanNeal
    <una> q+
    <andrico1234> JonathanNeal: i just want to clarify, does that mean things like role, and aria attributes?
    <andrico1234> masonf: yes that's correct. you apply attribute to element, that element comes with its own role and how its calculate. it doesn't change
    <gregwhitworth> ack una
    <gregwhitworth> q+ vicgutt
    <gregwhitworth> q+
    <masonf> una, you have a substantial echo on your audio
    <una> +1 the resolution, popup is at risk for a11y concerns, this resolves the concerns and still provides the needed functionality
    <una> we can provide demos for common usecases
    <una> that are accessible
    <gregwhitworth> ack vicgutt
    <andrico1234> vicgutt: wrt to a11y, the definition of the element we add attribute to. there would be a dedicated element for these popups? is that correct? and those elements would have the semantics defined
    <una> but i'd also want the UA to accessibly focus/apply semantics on the element when popup is open
    <andrico1234> masonf: yes, but that would be phase 2
    <una> Would that mean that folks would still need to use JS for accessible elements?
    <andrico1234> vicgutt: it would be beneficial to have that
    <andrico1234> masonf: it's phase 2, but once we have the mechanics, then defining an element becomes a lot easier
    <JonathanNeal> Oo, thank you for that great question, vicgutt. Now I feel I can +1 this.
    <andrico1234> gregwhitworth: semantics for roles, as it relates to aria-haspopup, will that be owned by popup, that would be in the controller code. if i have popup attribute. that anchor is no longer adding aria-haspopup by default. the new element will add that
    <una> +1 to make sure popup still provides a11y semantics for popup focus
    <una> (regardless of role)
    <andrico1234> masonf: we're not changing roles, attributes are a grey area.
    <andrico1234> masonf: the way ATs look at the tree and decides what to do is up to the a11y side of things, how it's interpreted. your question might fall on that side of the line. i'm unclear whether it would be ok for us to haspopup, but good question
    <JonathanNeal> Unless we have good element internals for ARIA, messing with just ARIA could still be messy. If I remove the popup attribute, would it also strip the ARIA attributes? Unless I overwrote them?
    <una> I have the same questions/concerns as Greg
    <chrishtr> q+
    <andrico1234> gregwhitworth: selectmenu does this out of the box. does the popup attribute come bundled with it? they are accessibility ones and make attribute accessible by default. the a11y comes the minute we implement tooltip elements, we'll do that wiring. i like that personally
    <JonathanNeal> If only the ARIA attributes existed in CSS, this would be a lot easier.
    <andrico1234> gregwhitworth: the attribute isn't bringing semantic baggage
    <andrico1234> masonf: i agree, selectmenu has controller code builtin and wiring is done correctly. maybe we shouldn't be doing anything at all attribute wise
    <gregwhitworth> ack gregwhitworth
    <gregwhitworth> ack chrishtr
    <JonathanNeal> q+
    <andrico1234> chrishtr: i thought the plan was that there would be not any implied attribute. popup attribute would be behavioural, and wouldn't say anyting about semantics, new elements would instead. and bring their own things like their own implied haspopup
    <andrico1234> chrishtr: in the meantime ATs can do their best, but devs should add their own aria attributes so ATs now what they're doing
    <andrico1234> in the meantime until phase 2
    <andrico1234> chrishtr: what you said about unclear to devs about what's going on, i.e. some attributes imply other things. good the atribute is explicit about behaviour. its a layering of api surfaces, 1. it's speaking to make it easy to achieve larger goals without doing it all at once
    <andrico1234> chrishtr: 2. for compat, there will be additional types of popups that we've missed, other edge cases. other popup behaviour, they can use it how they want, then we can codify it in Open UI
    <masonf> RESOLVED: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.
    <gregwhitworth> ack JonathanNeal
    <masonf> SORRY, didn't mean to add RESOLVED there.
    <masonf> Proposed resolution: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.
    <andrico1234> JonathanNeal: i want to +1 this, and +1 not messing with attributes. could be hard to remember. if i put popup on something, and it implicitly adds an aria attribute, what happens when I remove it
    <andrico1234> JonathanNeal: would been alot easier to discuss if we brought AT apis to CSS
    <JonathanNeal> +1
    <andrico1234> gregwhitworth: i like the move from async, super confusing for me
    <andrico1234> masonf: sorry fr accidentally resolving, but added an extra bit on the end
    <masonf> RESOLVED: The popup attribute in HTML will describe only behavior (what it does, such as top layer, dismiss behavior and so on) and not semantics (what it should mean to other tools such as accessibility, including the role and aria-* attributes). Also rename popup=async to popup=manual.
    <gregwhitworth> Zakim, end meeting
    <Zakim> As of this point the attendees have been gregwhitworth, JonathanNeal, dandclark, andrico, bkardell_, una, chrishtr, masonf, tantek
    <Zakim> RRSAgent, please draft minutes
    <RRSAgent> I have made the request to generate https://www.w3.org/2022/06/23-openui-minutes.html Zakim
    <Zakim> I am happy to have been of service, gregwhitworth; please remember to excuse RRSAgent. Goodbye
    <gregwhitworth> RRSAgent, please leave
    <RRSAgent> I see no action items
  19. removed
    agenda+
    on Jun 23, 2022
  20. added a commit that references this issue on Jun 24, 2022
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

    popover

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions