material icon indicating copy to clipboard operation
material copied to clipboard

Long ngMessage causes box to grow in horizontal space

Open davidpoxon opened this issue 10 years ago • 4 comments

Issue: A long ngMessage causes a box to grow in horizontal space Angular version: 1.03 Browser: Chrome, others not tested Example: http://codepen.io/noilly/pen/PZyreb

davidpoxon avatar Feb 08 '16 01:02 davidpoxon

I'm not sure this is a problem with ngMessage as it just hides/shows a <div>. For instance, take the following Codepen: http://codepen.io/topherfangio/pen/VeqWWg?editors=1010

We simply show a standard <div> when the button is clicked and it too makes the box grow. This is the nature of HTML and CSS. If you want the containing box to stay the same size, you'll need to set it's size using the width/height properties, or perhaps some of the flex layout attributes.

Did this work differently for you in a prior version of Material?

topherfangio avatar Feb 10 '16 22:02 topherfangio

@topherfangio - Here is an example where the input message was too long: http://codepen.io/team/AngularMaterial/pen/NxZZjY.

See login dialog, email error message

I was forced to use this:

md-input-container {
  .md-input-messages-animation {
    max-width:300px;    
  }
}
  1. The class .md-input-messages-animation was not intuitive
  2. Seems like it should be max-bound by the parent container: md-input-container ?

ThomasBurleson avatar Feb 25 '16 00:02 ThomasBurleson

@ThomasBurleson I see what you're saying.

I suppose we could calculate it in JS every time we show the message and set the max-width property to match the parent. My only concern (and it's a tiny one at that), is that resizing the parent container to make it bigger would misalign the messages with the input.

topherfangio avatar Feb 25 '16 21:02 topherfangio

This issue is closed as part of our ‘Surge Focus on Material 2' efforts. For details, see our forum posting @ http://bit.ly/1UhZyWs.

ThomasBurleson avatar Jun 02 '16 07:06 ThomasBurleson