-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theming options #18
Comments
My take is that we should have themes for semantically distinct categories of toast, which might affect the behavior. (For example, for accessibility technology, it's possible we may want warning and error to be more interruptive than default or success.) There should be some default styling for each theme, but the main point of a theme is to communicate categories and intent, not to create styling. So, specifically toward the last question, I don't think allowing user-supplied themes is important, since we already intend to support user-supplied styles. If there are more interesting semantic categories of toasts, then we should standardize them as a common vocabulary everyone should use, and not have per-application themes. |
Is "theme" the right name for this? I agree that the categories you're describing are more semantic/behavioral, whereas I more often see "theme" used for visual styling.
|
Agree - theme is a bad name, and will clash with CSS styles the user supplies. And also, no other HTML element supports anything like theme in the first place. Are there really different usecases for there to be an actual need for the attribute? How would an alert toast differ from a success toast semantically? As I see it, there would always be some text content, zero or more actions, and a close button. |
As @domenic points out, error toasts could have different a11y behavior, or linger on the screen for longer, or respond differently to preferences around muting (compared to info toasts). We'll also want some way to style different types of toasts differently, which could either be done by selecting this attribute, or via a developer-added class name (which would allow developers to use as many or as few toast types as they wanted). So I think it comes down to whether a) there's a pretty standard set of types and b) whether we can actually articulate how the behaviors would be different beyond "maybe they have different behaviors!" Then we'll be able to more easily see if we need types, and how many distinct ones there are. |
The starting point for a) is https://github.com/jackbsteinberg/std-toast/tree/master/study-group, FWIW. But yeah, b) is the key point that determines whether this is worthwhile. See also #25 which is the most concrete step in the direction of b). |
I think #25 also addresses a) above. ARIA has defined the standard set of types. For new patterns that emerge / have emerged since, then they will need to have their accessibility properties defined before they can be implemented anyway. Which means the accessibility work to define them would be concurrent and should include the WAI team. IOW, two concurrent paths:
|
I agree with the sentiment that the name I think With respect to accessibility roles, I think
Assertive types such as |
I suspect (at this point) there would be no need to mint new ARIA roles. But I am curious why you group "errors" and "warnings" into mapping to the Not all errors nor warnings warrant the SR interrupting the user and not all status updates should wait for the user to finish a task. If the only difference you see is visual, then IMO that is not enough. How about leaning on the existing roles, which are already documented and have suggested practices. So perhaps:
Then you can borrow existing text from ARIA and authors do not need to juggle 4 values for |
As a developer, I agree with @aardrian's point that reusing existing roles would be ideal for authors,. Knowing when to use which type (and which browsers/AT they work in) is quite a burden already as it is. Adding more roles increases complexity for me as an author, I imagine it does too for browser and other parties. |
Addressing issue #18 Co-Authored-By: Domenic Denicola <[email protected]>
This is one take on the discussions in #18, that makes the existing text more concrete. The issue will remain open to discuss these details as well as alternatives.
It seems this thread has arrived at essentially two alternatives we should consider:
Historically, HTML has leaned on semantics for the attributes of its elements. It leaves granular control of screen-reader behavior to the ARIA family of attributes. Instead, HTML plus the accessibility-mappings spec (HTML-AAM) do their best to ensure that when authors use elements and attributes that have accurate semantics, this gives good-by-default experiences for screen reader users. As a concrete example, HTML has a semantic distinction between ordered lists, unordered lists, and menus ( In #49 I put up an initial draft proposal to flesh out the current README, which uses semantic types, instead of screenreader types. It maps between the two by saying that errors should map to the alert role (assertive), whereas the info, success, and warning types should map to the status role (polite). Like the ol/ul -> list, menu -> no role mapping, this seems like a solid starting point. Authors can always choose to override this, e.g. deemphasizing an error with I'd like to get folks thoughts on two things in particular:
For example, @aardrian argues that not all errors warrant the screen reader interrupting the user, and in his post, @scottaohara suggests toasts should always be |
At a high level i quite like the idea of the As you noted from my post, I do not think that an But that's not to say the option to change the type wouldn't be desirable for a more generic "message" or "notification" component that could be styled/behave as a pop-up notification, like a toast, or as a static or position-sticky element in the DOM that exists until a user dismisses, like a global alert or warning notification. |
I want to caution over-analyzing HTML-AAM and HTML to justify a particular approach.
That is not strictly true.
I defer to @scottaohara on HTML-AAM's intent and plans as he is an editor, but I feel its role here is orthogonal to this discussion. Now, to the larger point, you have identified 4 |
Toasts don't have to automatically expire; you can set their timeout to Infinity when showing them. So this case is within the scope of the repository, regardless of what the element is ultimately named (which, as you note, is an open issue, #33). One interpretation of what you're saying is that warning or error toasts should have a default timeout of Infinity. (Existing discussions have already suggested this for toasts with actions.) Does that sound like a good idea? We could update #49 in that direction. Would that impact your assessment of whether the screen reader behavior should change based on semantic type, or do you still think role=status is the only appropriate role for the toast pattern?
Like many distinctions in HTML, these are semantic distinctions. Other existing examples are ol/ul, or non-body-scoped header/footer/section, or samp/kbd. As a refresher, semantically-distinct elements often have different default styling as their only UA/AT impacts. But the main purpose of using semantic elements is not for styling; it's to communicate important distinctions to humans and machines. This purpose remains valuable for the HTML language even if those distinctions do not directly affect AT or UA behavior. |
You are citing different elements, not attributes on the same element. To use a closer analogue, If I have So let me ask a different way — what is functionally different among these 4
I may be missing a related issue, but what are those machine distinctions that do not affect UA nor AT behavior? (I think this question builds on my question above) |
I don't think that changes the argument.
I think I've answered this question pretty thoroughly: like the examples I gave of preexisting HTML elements, the difference is mainly semantic, not functional.
For example, CMS's, authoring tools, content indexers, conversion tools between HTML and other formats, ... there are many pieces of software that consume HTML content and utilize semantic distinctions. |
Ok. Above you say "the main point of a theme is to communicate categories and intent, not to create styling." For those four 'semantic'
Can you outline how you imagine these 4 |
Similar to non-body-scoped header/footer/section, or samp/kbd, or strong/em, or cite/i, I think users will likely not see much of the semantic distinction here directly. (The exception would be if it changed the ARIA role mapping or timeout behavior, which are still under discussion in this thread, but you've asked that we set aside the former for now.) The exception would be is if page authors choose to align their stylistic categories with the semantic ones, but that's a styling choice for page authors. (And to some extent for the default stylesheet, e.g.
http://seekbrevity.com/semantic-markup-important-web-design/ is one of the first Google results for "why semantic HTML matters", and it seems pretty reasonable. It details the content indexer and developer-facing aspects of semantic HTML. Of course it also mentions the accessibility benefits, but---as long as we're putting aside ARIA role mappings, at your request---those do not come in to play for the examples in question. Other results at https://www.google.com/search?q=why+semantic+html+matters seem to touch on similar themes. http://html5doctor.com/lets-talk-about-semantics/ in particular covers one of historical flare-ups of this debate that we're currently recapitulating. (That time about whether article/section is a useful semantic distinction, instead of our current debate about whether error/warning/success/info is a useful semantic distinction.) Since I don't have a reference for authoring tools off-hand, and it isn't obviously forthcoming in those search results, I'll give the example of how authoring tools today let you choose whether to use |
Thank you for humoring me. I am genuinely trying to understand intent. What I am getting from this conversation, and from your links, is:
Given that, here are my thoughts:
Otherwise, if these four proposed Without a clear proposal of how these 4
In my head I see HTML that might look like:
I find it helpful to talk in concrete terms sometimes, hence fake code. |
I see. It sounds like, going back to my post at #18 (comment), you're advocating for screenreader types, not semantic types. It's good to understand your position. My general inclination is that we already have mechanisms for screenreader control (role/aria-live), so we do not need a new attribute that duplicates that control. (And then we need to define the interaction thereof, between the two mechanisms of control.) Whereas, I do think there is a benefit in adding semantic meaning to toasts, for the reasons listed in the reading I linked to.
I disagree with the idea that HTML should stop adding semantic meaning to its elements unless that meaning is exposed directly to users. I think we would have a very different language if we were concerned only with user-exposed differences, and avoided semantics. And I don't think we should change course on that now. I can respect if you feel differently. What I am hearing, if you'll allow me to summarize, is that you would like to use the introduction of new elements, like toast, to change the standards for how we design HTML. You would like us to not introduce any new primarily-semantic distinctions, like we have in the past, but instead only introduce user-facing functionality. You believe that for the future, semantic distinctions (such as between ols and uls, or footers and headers, or kbd and samp, or error toasts and success toasts) can be handled by classes, microdata, and data- attributes. Let me know if this is inaccurate in some way. At this point it may be good to bring in more voices to the conversation. |
I still don't accept this fabricated distinction.
This is not a global HTML conversation, nor did I suggest what you assert.
I disagree with your entire assertion. That my points above lead you to this conclusion suggests that I was not clear. You did not challenge my assertions about your position above, so I take it to mean you have accepted them as-is. Those inform the following… Let me re-state and explicitly limit the scope to just the proposed element:
|
I see we are still talking past each other. I think it'll be best for me to step away, as we're not making much progress, but let me explicitly refute some things you're saying, since that seems important to you as otherwise you assume I accept them:
I don't agree that this is necessary. I think we have a long history of semantic information that is not exposed to users at all (article/section, etc.), or to all users (kbd/samp, ol/ul, etc.).
I agree. Nobody is proposing that.
I agree that we should map attribute values to existing patterns and behaviors. That is what the semantic types proposal is doing, based on the study group research.
The goal and purpose behind semantics is generally well-defined. Even if you do not agree, the existing patterns for toasts are well established, as the study group shows. |
@domenic commented:
Separating "semantic types" and "screen reader types" suggests a distinction that doesn't really exist. As an example: The
Such elements were distinct from elements like In the 1990s browsers and assistive tech parsed HTML documents more or less independently of each other. Browsers represented the headings visually in ways that conveyed their semantic meaning, assistive tech like screen readers represented the headings aurally in ways that conveyed their semantic meaning. The introduction of platform accessibility API changed the way assistive tech obtained the relevant semantic information, but did not change the semantic information itself. Instead of parsing HTML for themselves, assistive tech could query semantic information directly from the browser using the accessibility API. The way HTML elements with semantic meaning are mapped to the platform accessibility API is documented in the HTML AAM. Although ARIA makes it possible to override the default semantics of an HTML element in a way that is targeted only at assistive tech, it doesn't alter the fact that assistive tech makes use of the default semantics of HTML elements and always has done. So the "semantic type" and the "screen reader type" are necessarily one and the same thing. |
OK. There's quite a bit here to go over / comment on. This will be long. I appreciate your time on this, in advance.
OK, yes agree. If an author can config the component to not automatically dismiss, then that would require a dismiss button to get it out of the way (I also realize this has been discussed) ideally outside of the live region area so that the button's name is not announced as part of the component's message. e.g. The announcement of an example message should be "Your file was saved" not "Your file was saved dismiss notification".
I think that would be an important feature of this component, disallowing a timeout if the type of message was an error/warning in nature, or if the element contained an interactive element. Otherwise for more benign messages (info/success) an author would be allowed to set a timeout (again as long as the message didn't contain an interactive element). For clarity, I do not consider a close/dismiss button a control that would negate the timeout as that would be a part of the component and not the content added by the author. An aside: it would be amazing if users could override an author set timeout. For instance via a browser or OS-level setting. I realize a user-level setting like that is more than likely out of scope here, but it'd help alleviate the issue of what's deemed enough time for some people does not equate to all people.
My assessment of a "toast" needing to adhere to That said, having an opportunity to allow for additional features that would modify the functionality and semantics of the component, to ensure proper accessible usability for all, considerably loosens my more strict outlook of what a "toast" (but again, wouldn't call it that) should be. So, if the author can set a type to determine the assertiveness and importance of a message, where more important messages would not allow for an auto-dismissal, then that should allow for a change in what the underlying semantics of the message container should be. Now, specifically on the topic of semantic "types" (info, success, warning, error), while I understand the intent to cow path some long standing CSS class names, if you break down what these messages often consist of you're really just talking about divvying up "status" and "alert" messages. For instance, imo a "success" message is really just a green colored information message. And both "success" and "info" are really just types of "status" messages. An error is an "alert". A warning could be either a status or alert depending on severity. This is why I think it makes much more sense to adhere to what you're calling the "screen reader types", though I point to Léonie's response regarding this designation. CSS can and should be used by authors to differentiate any further. Then with those two types, allowances could be made for the expected customizations, much like how |
@LJWatson the post you're referring to defines the terms I'm using at the beginning. To reiterate them, "screenreader types" are alert/status or live/polite, whereas "semantic types" are info/success/warning/error.
This is great feedback. I've filed this against our implementation (for which the close button has recently landed) as https://bugs.chromium.org/p/chromium/issues/detail?id=985871. We should also look in to updating the explainer to make sure this is clear.
This makes sense to me. I'll revise #49 so that warnings and errors have a default timeout of Infinity, and a default of showing the close button. Let's discuss further steps in #37, e.g. for action-containing toasts. (There we can also get into discussions about how strongly we try to enforce the defaults.)
We've been in talks with @alice about this. Basically, today, to achieve WCAG 2.2.1, site authors need to add their own timeout customization UI. For toasts, we could continue this tradition, i.e. site authors need to add their own customization UI for WCAG 2.2.1, and thread down the results of that customization to Alternately, we could attempt to standardize a new mechanism a UA-level setting, e.g. for "ephemeral notification timeouts", or perhaps something more general. This could then apply to toasts, but also be filtered down to page authors (e.g. via There are a lot of tradeoffs here, and it's a complex space, so it's hard to say what's best. But this would be a good topic to spin into its own issue.
I don't think this is an accurate representation of the semantics of info, success, warning, or error. These are more than just CSS class names; they mean fundamentally different things, in the same way (or arguably more so!) than distinctions like article/section or kbd/samp. We can make assumptions that infos and successes should be announced politely, but not always. For example, a financial trading app may consider certain pieces of "info", or certain "successes", as imperative to alert the user about as soon as possible, interrupting their current task. And as you point out, it's not clear whether warnings should be interruptive or not. Finally, I've certainly seen a lot of errors in my time that are not very important. (E.g. "Unable to cache images for offline use".) So I think having separate axes, semantic categorization vs. screenreader politeness, is important. If nothing else, to allow them to vary independently. The question I'm hoping to get input on, is whether there are meaningful default mappings between the semantic distinctions in question, and the politeness levels announced to screen-readers. I think as a baseline, we should be polite. (A good rule in life in general.) And I think that authors who are aware of the concept of politeness levels, should be able to customize it using the familiar technologies they have today, viz. |
Since the only concern I see here for the four proposed Alternately, using confusing Informed defaults with the ability to override. Or 1:1 mapping to existing |
@domenic I think perhaps you misunderstood my comment. Any distinction between "semantic types" and "screen reader types", however you might try to separate them, is meaningless. You and @scottohara already noted that the information types (warning, error, info, success) have a logical mapping to the accessibility layer (status/alert, assertive/polite). So your question asking whether your "semantic types" or "screen reader types" made more sense, was in itself non-sensical because they're one and the same thing. |
I'd say a hard yes on an "error" mapping to Regarding the semantics of the other types, per your response I think (hope) we're actually more aligned on this than may have originally come across?
So, your thoughts here make me think more that types should be limited to status / alert (or any other naming that could indicate "passive" vs "assertive") and then use classes to style. As authors could very well then say "I want this success message to be assertive and not dismiss until the user has definitely seen it / interacted with it" or "this message is really of little consequence, but someone up the PM chain REALLY wants this to be a 'warning'." So style it like a warning but give it a status/polite behavior. If the component were to use all four types that have been outlined above, then seems to me that there'd be a need for mapping these types to roles/behaviors, and then another config to determine an assertion level to potentially override a types default assertion level. But sticking with two and then allowing for author styling would allow for the customization you and I both seem to want. The other thing to consider here being what you noted should be discussed in issue #37. So I will re-review and comment there at some point in the near future. |
It depends on if you thing there's any semantic value in distinguishing between info, errors, warnings, and alerts, beyond just using stylistic classes. I think there is, and that there's a lot of ecosystem evidence to back that up. I think that value is separate from, but additive with, using attributes to control screen reader politeness. That is why I say they should be varied independently. You seem to be saying that if people want to convey semantic distinctions between info, errors, warnings, and alerts, they should only do so with classes, and not with semantic attributes. I disagree with that; I think those are valuable semantic distinctions, not just styling distinctions. Perhaps the core point of misalignment is that I see value in semantics apart from how they control screen-readers (or styling). For example I think kbd vs. samp is a useful distinction, or ol vs. ul, or section vs. article. Similarly I think success vs. info is a valuable semantic distinction, even if it does not change screen reader behavior.
Well, we already have that config, namely |
I'm trying to say that in regards to how a live message can be conveyed it's either going to be "polite" or "assertive" and that the content of the message / intent of the author is what will designate what it needs to be. Could there be 4 types that map to the two roles (alert/status)? Yes. Warning being the one that I think would be the most debated about which role it fell under. I think what I've been leaning away from, but haven't made it clear in my responses, is that as you've said I hope that helps clarify my position on this particular topic. |
This is one take on the discussions in #18, that makes the existing text more concrete. The issue will remain open to discuss these details as well as alternatives.
This is one take on the discussions in #18, that makes the existing text more concrete. The issue will remain open to discuss these details as well as alternatives.
Themes are a common pattern with toasts, and the intention is to build some themes into the std-toast. A non-exhaustive list of current ideas for themes:
Is there strong feeling that this doesn't cover it? Do people feel a distinction between Default and Info? Additionally, while these will be built to be styled, is there strong opinion that there should be a way to add new themes beyond existing support for styling?
The text was updated successfully, but these errors were encountered: