toast: toasts should always be displayed in the visible viewport
Toasts should ideally be visible no matter where I am on the screen if I give no container element and set the position to one of the corners. Thoughts on setting it to position: fixed; in this case?
@ilanbiala I think it might be how it is now so that it can bump the md-fab buttons up a bit when it opens.
Also it moves correctly when I scroll are you sure you're using md-content correctly? If so could you please make a plunker so we can confirm this.
I'm looking into a good solution for this. The reason that a simple position fixed doesn't work is because, what if there's a fab button? What if there's a toolbar?
I'll be looking into a good solution for 0.7.1
To me it seems the toast scrolling around is much more broken than it eclipsing a FAB or toolbar for a few seconds. Toast is used for short-term important things we definitely want the user to see.
I'd rather wait for a better fix. If a toast goes over a fab it will be hard to read anyways so it hardly seems better than the current situation.
I'd say just apply the position:fixed locally if you prefer that.
Pseudo code implementation for toast onShow... for future reference
onShow() {
var fabs = document.querySelectorAll('md-fab');
var intersectingFabs = fabs.filter(willIntersect);
options.intersectingFabs = intersectingFabs;
angular.forEach(intersectingFabs, function(el) {
el.classList.add('md-toast-intersecting') // transition animation
if (position.indexOf('top') != -1) el.classList.add('md-toast-enter-from-top'); // set position accordingly
})
var toolbars = document.querySelectorAll('md-toolbar');
var intersectingToolbars = toolbars.filter(willIntersect);
if (intersectingToolbars.length) {
element.addClass('md-with-toolbar') // change position relatively
element.style.top = calculateOffsetToNotIntersect(element, intersectingToolbars[0]);
}
}
Agree, toasts should be always visible. +1
+1
+1
I'm on the 'always show' team. Suppose you have two fab buttons, user is about to click the bottom one, then a toast pushes them both down and the click the wrong one.. Buttons shouldn't move around unexpectedly.
I just edited my angular-material.js file: line 11979 'md-' -> 'md-fixed-'
then in my css
md-toast {
z-index: 10000;
}
.md-fixed-top {
position: fixed;
top: 66px; // size of my navbar + 16px
}
.md-fixed-right {
position: fixed;
right: 16px;
}
... etc for left/bottom
@ThomasBurleson @rschmukler @robertmesserle can we get some discussion going to resolve this? As of now, If I am in the center of a scrollable page, no matter where I put the toast I won't see it, which defeats the purpose of the toast. Is there a better option than position fixed?
The Team's concern is still this:
- The reason that a simple position fixed doesn't work is because, what if there's a fab button?
- What if there's a toolbar?
@ThomasBurleson
Things that pop up seemingly randomly to the user shouldn't move clickable buttons -> have the toast overlap FABs you don't want to cause http://i.imgur.com/C0biWU3.gif
For toolbars, pick a default, users can override it in their css if they need to
@charliewynn - Please read the Material Specifications for Toast
@ThomasBurleson If we're strictly following the spec then
"Toasts are similar to snackbars but do not contain actions" and it implies that toasts should only animate from the bottom
I know my suggestion isn't perfect.. but it is so much better than showing toasts off-screen
Just chiming in, for my application I have an md-toolbar on top of which the toast appears. I am ok with that as long as it sits on top of anything that is there, instead of moving that elements position.
Also, as my page is scrollable, any info I wish to show to the user via the toast becomes useless as the toast is not visible when the user has scrolled to the middle of the page.
Setting the toast to appear at the bottom also causes issue reported in #2936
Fixing the position seems currently the better option unless someone can suggest something better. Cheers!
@ThomasBurleson how was this resolved? Are toasts position: fixed now?
Toasts are position:absolute; If scrolling presents an issue, then perhaps we should auto-hide toasts on scroll events.
@ThomasBurleson Is that the final resolution for this issue? If you hide a toast on scroll events, then what happens if I show a toast while a user is scrolling...He won't see it, but I don't know that.
@ilanbiala - let's reopen this for now. But it definitely is a lower priority issue... as we are focused on triage and delivery of v1.0.
Ok. Just to get some more information and maybe to allow one of us to propose a solution, what are you guys currently thinking about other than covering toolbars and FABs? What are the alternatives as of now?