material icon indicating copy to clipboard operation
material copied to clipboard

mdToast: improve UX to support theme colors and multi-toasts to show

Open ThomasBurleson opened this issue 11 years ago • 13 comments

See Oh Snap! for comparative UX:

screen shot 2015-05-16 at 10 40 57 pm

ThomasBurleson avatar May 17 '15 03:05 ThomasBurleson

@joeyperson - This seems like an entirely reasonable and useful UX; especially for desktop experiences.

ThomasBurleson avatar May 17 '15 03:05 ThomasBurleson

This is what I wondered when reading the material design specs. A single toast popping up and being replaced by another is perfectly valid UX on mobile because the user doesn't want to be overwhelmed by a line of toasts blocking their view.

But on desktops with ample space and screen real estate, to restrict the developer to a single toast whose information is hidden by another isn't really necessary.

aniforprez avatar May 18 '15 15:05 aniforprez

Having a distinct color makes total sense, especially as dark designs would not work well with a dark toast with little contrast.

Re: multi-toasts, I think the idea is to keep toasts to a single event at a time, as there may be actions that are available for them, and could fade out of view before reading them all. If many messages are needed, I'd imagine using a different pattern that could include a list of alerts.

joeyperson avatar May 19 '15 21:05 joeyperson

Yup, otherwise every project would define the red error message and the green success message.

adrianandreias avatar May 30 '15 07:05 adrianandreias

Word from UX: it's okay to allow (we're not going to be the bad ui police)

jelbourn avatar Aug 12 '15 23:08 jelbourn

@EladBezalel

The goal is to easy apply a different theme (background and text color) to custom toasts. If I add this change to src/components/toast/demoBasicUsage/script.js:

.config(function($mdThemingProvider){
    $mdThemingProvider.theme('splashRed')
        .backgroundPalette('red');
  });

And then use this:

var toast = $mdToast.simple()
        .textContent('Marked as read')
        .action('UNDO')
        .theme('splashRed');

Then splashRed theme is not used... nor is it contained in the THEMES internal registry.

Seems like a major bug.

ThomasBurleson avatar Mar 14 '16 15:03 ThomasBurleson

@ThomasBurleson I was trying the exact procedure to switch the the theme on mdToast and its not working for me either. Using 1.0.6. The theme I am using is "success" and its registered:

image

The docs seem to say that it should work. Will this be fixed in 1.0.6 or 1.1.0?

trainerbill avatar Apr 01 '16 19:04 trainerbill

After inner conflicts about this issue i came to those resolutions:

  • Toast shouldn't support background and foreground color change by the theme.
  • Toast shouldn't support background and foreground color via a public api
  • Toast should (and supports) any style changes by overriding material classes

You can see a demo here

@ThomasBurleson thoughts?

EladBezalel avatar Jun 12 '16 19:06 EladBezalel

@EladBezalel codepen fails due to wrong ngMaterial reference: http://localhost:8080/angular-material.js

DmitryEfimenko avatar Jun 12 '16 21:06 DmitryEfimenko

@DmitryEfimenko fixed thanks :)

EladBezalel avatar Jun 12 '16 22:06 EladBezalel

if you care for my opinion - @EladBezalel's resolutions sound great to me. Style changes are very easy. This just needs to be documented.

DmitryEfimenko avatar Jun 13 '16 07:06 DmitryEfimenko

Actually, creating a separate template for each toast you want to show is painful. Just let developers apply whatever class they want to the <md-toast>. Then they'll be able to style things that way.

let message = this.$mdToast.simple();
message.toastClass('my-error')
md-toast.my-error .md-toast-content {
    background-color: red;
}

DmitryEfimenko avatar Jul 05 '16 08:07 DmitryEfimenko

@DmitryEfimenko sounds reasonable.

EladBezalel avatar Jul 05 '16 15:07 EladBezalel