-
Notifications
You must be signed in to change notification settings - Fork 3.4k
toast: toasts should always be displayed in the visible viewport #1106
Comments
@ilanbiala I think it might be how it is now so that it can bump the Also it moves correctly when I scroll are you sure you're using |
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 |
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]);
}
} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 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 |
+1 @BigBadaboom workaround. Thanks! |
Great workaround, thank you! I also had to override the style for smaller screens (smartphone): |
I really appreciate people helping others in this thread and posting constructive ideas and feedback! However, while there are a lot of rough descriptions and ideas in this thread, I don't see any CodePen demos that clearly demonstrate the issue. If I missed one (I tried to read all of the comments), please just re-post the CodePen link for me. Can anyone submit a CodePen demo that clearly demonstrates the problem so that I can consider and verify a solution? |
Requested CodePen reproduction not provided. |
There is a codepen in the bug #3539 which was marked a duplicate of this one. http://codepen.io/anon/pen/zGRZav Here's another one. The toast appears off screen. (Click the button and then scroll down quickly to see the toast). |
@BigBadaboom thank you. I updated the first to |
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?The text was updated successfully, but these errors were encountered: