Skip to content

Snackbar action styling inconsistent / poor contrast #13905

Closed
@thw0rted

Description

@thw0rted

Bug, feature request, or proposal:

Bug (spec violation)

What is the expected behavior?

Under any theme, the snackbar action button should be a color that a) provides readable contrast and b) is different from the body text color. The exact line in the spec is "The text label shouldn’t share the same color as the text button".

What is the current behavior?

With a light theme, the color used is the accent color. Snackbar background is the opposite of the main theme background, i.e. dark background when a light theme is used. Light-theme accent is chosen to provide contrast against a white background, and the primary color -- this does not necessarily mean that it provides adequate contrast against a dark background. This can probably be fixed by selecting a lighter variant of the accent.

With a dark theme, the body text color is used, as far as I can tell. This is a spec violation, as quoted above. The spec doesn't provide an example of action button text in a dark theme (light background snackbar) but presumably you'd want to use a dark version of the accent, for adequate contrast.

What are the steps to reproduce?

Open the docs example for Snackbar and choose a light theme in the top menu bar. Click "show snackbar": the action button text is shown in the accent color. Arguably the two included light themes use an accent that works pretty well on both light and dark backgrounds, but that's not always going to be true. Try it with one of the dark themes, and the action button shows up in dark gray, matching the color of the main snackbar text label.

What is the use-case or motivation for changing an existing behavior?

Spec compliance, accessibility (text contrast)

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All, I think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/snack-barmaterial specIssue related to the Material Design spec https://material.io/design/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions