-
Notifications
You must be signed in to change notification settings - Fork 56
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
A toast UI element #385
Comments
Something like this definitely needed. The |
Hey @mkay581 thanks for taking a look at this. The intention here is to create a new HTML element, going through the usual process that requires, and using a @domenic's latest comment in this thread on the |
Problems with this approach (also applicable to
It's worth thinking about these problems and trying to solve them before creating too many elements with this pattern. |
A bunch of the discussion in #384 likely applies here as well. |
(Not actually sure if this repo is meant for general public commenting, sorry...) HTML elements are meant to be single words with no |
"Toast" seems like the standard term for expiring non-modal notification windows on Android and Windows. On iOS and MacOS they are called "banners", or if you want to be really specific, "temporary notification banners". I guess the intention here is to provide an in-page version of this functionality, which is why it's new stuff instead of additions to Notifications API. I do think "toast" is a an odd jargon term that will be really clear in some communities and really confusing in others. Another thought: why isn't this instead an addition to |
As a non-English speaker, I don't find banner any more clear. Especially banner (I think flag like thing) is often used as a loanword with very specific meaning (toast as well which is normally a heated sandwich and just that). As a non-English speaker, words like tooltip are just as bad, but you learn exactly when they represent quickly, so I don't think the name is a big blocker. I think something like |
Thanks for requesting feedback @jackbsteinberg. I really appreciate the intention behind this proposal: to pave web developer cow paths 🐄, and to make more accessible defaults🤗. At the same time, I was surprised to see this API being developed separately from the notifications API and Separately, I also agree with previous commenters that "toast" feels too platform specific for the web, and that the std prefix won't age well. Thanks again for working on improving the web platform! I think there is a ton of potential here to make the web a stronger and more accessible platform. I am extra appreciative of your time working on toast, reviewing feedback, and building consensus with TAG, web developers and multiple implementers. |
Consider following the "problem-statement-first" WHATWG process. This builds consensus through public discussion of the problem prior to proposing a solution. |
according to this page: https://developer.mozilla.org/Web/HTML/Element i am counting at least 200 HTML elements currently (forgive if my selector is bad):
are we really saying that none of the current elements can fill this role? I agree with @zcorpan, this seems like a vanity project and should go through the normal process. not be rushed through "because google". |
This wouldn't happen to be motivated by, say, a return to class for the fall semester? Anyways, some questions. <std-toast id="sample-toast" theme="info">
Hello World!
</std-toast>
import { showToast } from 'std:elements/toast';
const toast = showToast("Hello World!", {
theme: "info",
duration: 3000
});
Thanks for starting a discussion, anyways! |
Hi @crertel can you please file these issues on the project/spec repo, so they get properly tracked.
Please avoid sarcasm and/or ironi in this repo, and keep the discussion focused |
I've posted whatwg/html#4696 and whatwg/html#4697 to centralize discussion around polyfillable element names and pay-for-what-you-use HTML elements. A lot of the other things folks have mentioned in this issue are already being discussed in the std-toast repo, which is great; that's why we file for feedback early! |
@jackbsteinberg I'd like to see @boazsender's question addressed : why is this separate from the notifications API? |
Also regarding venue, what is the roadmap to bring this to WICG or similar? |
@torgo the difference is that this is a temporary notification / infobar, like you see for PWAs ("new version available, press reload to refresh") or like in GMail ("Chat is currently unavailable") etc. These are not things you want an actual system notification for... They really depend on the surrounding content/situation unlike regular notifications |
import { showToast } from 'std:elements/toast';
const toast = showToast("Hello World!", {
theme: "info",
duration: 3000
}); Does this format not completely deviate from API currently in browsers? It looks to me Google is proposing to overload imports and stub in their own. This would make it difficult to polyfill in older/non supported browsers, too? I also echo the comments from others that it feels like an existing element e.g Having a way to define and position popups/toasts around other elements is long overdue. Maybe cc/ @FezVrasta can also share his thoughts on this proposal (author of Popper.js) |
Ok I think I've totally misunderstood the point of this new toast proposal. The name is very confusing. I was thinking it was to do with adding tooltip positioning-like functionality in the browsers, like Popper but it looks like this is more to do with dialogs e.g. Sweet Alert ? I was hoping for some kind of positoning engine native to browers so you can position things like the way it's described in the proposal: Meh. This whole thing doesn't seem as useful now as it seem so specific and opinionated, plus the functionality does overlap with |
I second that concern. For example, how long is an appropriate timeout for accessibility, and what other features of this proposed element affect its accessibility? Should it have an implicit ARIA role (something like "alert")? These are just a few points that immediately come to mind. |
We talked a bit about this in the TAG today. The feature seems to be an accessibility anti-pattern, according to the accessibility folks on the team, but that of course won't stop people from using the "toasts/banners" on their sites, so if a standardized toast can improve the accessibility story that is a net win. That said, we are very interested in hearing now the std-toast will handle accessibility, as it is presumable out of the accessibility tree and might even interrupt and confuse the user. For instance the screen reader might be reading a particular section, and interrupting that could be quite confusing. Nitpicking on the name, we do agree that the name is not perfect, but neither is snackbar as used on Android. Maybe something like infobar might be better. |
@jackbsteinberg one thing to note: I wanted to mention that the readme on this proposal (the explainer) is really good. I especially like the use of an animated gif to illustrate the concept, and the time you've taken to explain the concept. |
I think the main issues developers will have with the proposal of a
Rather than having a whole new component, would it be better to instead have a low-level tool where you can position toast-like elements, or tooltips, and leave any opinionated styling or implementation details to developers? The easiest part of building toast-like elements is the UI however the tricky bits are:
Each of these could be solved by low-level tools which would serve multiple purposes not only for toasts but other UI and components, such as tooltips etc. I'm thinking something like: const position = new StickyElement(document.querySelector('#tooltip'), {
// Calculate best possible position so element is visible on screen
// First try top-center, then bottom-center, etc.
position: ['top-center', 'bottom-center'],
// Calculate relative to the root element, if not supplied will default to document root.
root: document.querySelector('#tooltip-container')
});
position.translate(); // translates / moves the actual element to the best calculated position (one time)
position.track(); // Automatically translate / track whenever browser is resized / scrolled.
position.getRect(); // Returns the `Rect` object for the current best calculated position. Along with maybe a way of stacking elements? const stack = new ElementStack({
root: document.querySelector('#scroller')
});
stack.append(positionedElement1);
stack.append(positionedElement2);
stack.prepend(positionedElement3); Maybe this is already kind of possible with tools that |
We've identified a number of meta-issues here. We discussed in the TAG call today. We agreed to put some time on the agenda for our next face-to-face to discuss these meta-issues and try to come to some actions. |
How is the import mechanism here related to HTML Modules? (HTML Modules is covered by our #334.) Is it the HTML modules import mechanism that's being used here, or not? (If not, then what is, and what defines it?) The examples here don't seem to match the examples there. |
They aren't very related, except that they are both types of modules. What's being used here is Web IDL modules. |
What is the future of this proposal given that Web IDL modules don't seem to be moving forward (whatwg/webidl#675)? |
Similar to issue #384, let's close this review request for now. Thanks for your feedback and comments. |
Closing in response to #385 (comment) Thanks for flying TAG. |
こんにちはTAG!
I'm requesting a TAG review of:
Further details:
We'd prefer the TAG provide feedback as (please select one):
The text was updated successfully, but these errors were encountered: