Materialdesigninxamltoolkit: Snackbar - "Auto" ActionButton placement doesn't always work

Created on 8 May 2020  路  5Comments  路  Source: MaterialDesignInXAML/MaterialDesignInXamlToolkit

My app defaults it to SeparateLine because Snoop shows 51 on ActualHeight of SnackBar
Forced to Inline to show ActualHeight:
image
This is when app defaults it to SeparateLine
image

From Kevin:
"I think the issue is our 49 default is just a little too small and we need to bump it up a bit or revisit trying to make it a little more dynamic"

Forcing materialDesign:SnackbarMessage.InlineActionButtonMaxHeight="51" proves this theory

bug up-for-grabs

Most helpful comment

If no one has a better idea I stayed with the InlineActionButtonMaxHeight and increased the threshold to 55.

This is better for wider snackbars (like example 5 in demo app) then using a discrete button width.

To avoid layout loops the value must stay below 94 (the height of single line message with button on separate line)

All 5 comments

I took the 49 from https://material.io/components/snackbars#specs as 48 is the minimum height for a single line message and above that the action button is moved on separate line. Seems that was only working for me. It would be no problem to set it to 58 or so.

But I found a potential dangerous loop with the dependency of the placement to the message size:
Take a text that is long enough to break on a second line but short enough for a single line when the action button is on a separate line. In that case it would change infinitely.

Also this image from the specs seems to recommend a separate line for the action button, when the button it self is wider:
image

So may be a SnackbarMessage.InlineActionButtonMaxWidth with default 100 (about one third of min-width 288) or so would be better.

Or even better a relative width-share to support wider snackbars like example 5 from Demo-App.
SnackbarMessage.InlineActionButtonMaxRelativeWidth with default 0.33

Hm. Forget ae2d71c. this also can lead to layout loops.

I think only SnackbarMessage.InlineActionButtonMaxWidth with a default 100 or tell me what value you want here is stable.

If no one has a better idea I stayed with the InlineActionButtonMaxHeight and increased the threshold to 55.

This is better for wider snackbars (like example 5 in demo app) then using a discrete button width.

To avoid layout loops the value must stay below 94 (the height of single line message with button on separate line)

Thank you very much for making this change. I fully trust your judgement :)

I think 55 is a reasonable default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olegsavelos picture olegsavelos  路  11Comments

greuelpirat picture greuelpirat  路  12Comments

zirius666 picture zirius666  路  12Comments

sagevpremium picture sagevpremium  路  10Comments

darturdotnetdeveloper picture darturdotnetdeveloper  路  11Comments