Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

input-container: not showing ng-messages error by default even when md-auto-hide="false" is applied #9723

Closed
nghilevi opened this issue Sep 29, 2016 · 4 comments
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. resolution: fixed ui: CSS
Milestone

Comments

@nghilevi
Copy link

Actual Behavior:

  • What is the issue? *: Under md-input-container, when applied md-auto-hide="false" tong-messages, error message(s) is not shown by default.
  • What is the expected behavior?: If the input is invalid, error message(s) should be shown by default when md-auto-hide="false" is applied on ng-messages.

CodePen (or steps to reproduce the issue): *

Angular Versions: *

  • Angular Version: 1.5.5
  • Angular Material Version: 1.1.1

Additional Information:

  • Browser Type: * Any
  • Browser Version: * Any
  • OS: * Any
  • Stack Traces: Any
@nghilevi nghilevi changed the title md-input-container not showing ng-messages error by default even when md-auto-hide="false" md-input-container not showing ng-messages error by default even when md-auto-hide="false" is applied Sep 29, 2016
@nghilevi
Copy link
Author

nghilevi commented Sep 29, 2016

Currently my quick and dirty fix in our project is:

Add these lines of code to
https://github.com/angular/material/blob/master/src/components/input/input.scss

.ng-pristine.ng-invalid{
  md-input-container {
    .md-input-messages-animation:not(.md-auto-hide){
      .md-input-message-animation {
        &:not(.ng-animate) {
          opacity: 1;
          margin-top: 0;
        }
      }
    }
  }
}

This ensure that the error message will be appeared from the start when there is no md-auto-hide.

Also I replaced this logic:
https://github.com/angular/material/blob/master/src/components/input/input.js#L993-L995
with this:

if (messages.hasClass('md-auto-hide') && !container.hasClass('md-input-invalid')) {
    return $animateCss(element, {});
}

if (alreadyVisible && !messages.hasClass('md-auto-hide') && container.hasClass('md-input-invalid')) {
   return $animateCss(element, {});
}

Still the label is NOT colored red by default. I have tried this but it didn't work:

.ng-pristine, .ng-invalid{
  md-input-container {
    label ~ .md-input-messages-animation:not(.md-auto-hide){
      color:red;
    }
  }
}

I guess to make that possible some logic inside inputTextareaDirectiveshould be changed.

@ThomasBurleson ThomasBurleson added this to the 1.1.2 milestone Oct 14, 2016
@ThomasBurleson ThomasBurleson added the P4: minor Minor issues. May not be fixed without community contributions. label Oct 14, 2016
@topherfangio topherfangio self-assigned this Oct 25, 2016
@mikila85
Copy link

+1

@ThomasBurleson ThomasBurleson modified the milestones: 1.1.2, 1.1.3 Nov 29, 2016
@ThomasBurleson ThomasBurleson modified the milestones: 1.1.3, 1.2.0 Jan 1, 2017
clshortfuse added a commit that referenced this issue Jan 10, 2017
With commit cf7f21a, animations were moved to input.js in response to an ng-enter
flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs
arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug.

* Remove JS animations for input messages
* Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+
* Use `.ng-enter:not(ng-enter-active)` to prepare animations on 1.3+ and below
* Update spec tests to use getComputedStyle instead of ngAnimate

Fixes #6767, #9543, #9723, #10240

Related: angular/angular.js#13408
clshortfuse added a commit that referenced this issue Jan 10, 2017
With commit cf7f21a, animations were moved to input.js in response to an ng-enter
flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs
arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug.

* Remove JS animations for input messages
* Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+
* Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3+ and below
* Update spec tests to use getComputedStyle instead of ngAnimate

Fixes #6767, #9543, #9723, #10240

Related: angular/angular.js#13408
clshortfuse added a commit that referenced this issue Jan 10, 2017
With commit cf7f21a, animations were moved to input.js in response to an ng-enter
flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs
arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug.

* Remove JS animations for input messages
* Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+
* Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below
* Update spec tests to use getComputedStyle instead of ngAnimate

Fixes #6767, #9543, #9723, #10240

Related: angular/angular.js#13408
clshortfuse added a commit that referenced this issue Jan 10, 2017
With commit cf7f21a, animations were moved to input.js in response to an ng-enter
flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs
arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug.

* Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+
* Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below

Fixes #6767, #9543, #9723, #10240

Related: angular/angular.js#13408
clshortfuse added a commit that referenced this issue Jan 10, 2017
With commit cf7f21a, animations were moved to input.js in response to an ng-enter
flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs
arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug.

* Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+
* Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below
* Update spec tests to use computedStyle

Fixes #6767, #9543, #9723, #10240

Related: angular/angular.js#13408
@clshortfuse clshortfuse added the has: Pull Request A PR has been created to address this issue label Jan 10, 2017
@ghost
Copy link

ghost commented Jun 15, 2017

Hi there, Is this still an issue?

@Splaktar Splaktar changed the title md-input-container not showing ng-messages error by default even when md-auto-hide="false" is applied input-container: not showing ng-messages error by default even when md-auto-hide="false" is applied Feb 12, 2019
@Splaktar Splaktar modified the milestones: Future, 1.1.5 Feb 12, 2019
@Splaktar
Copy link
Member

Fixed in 1.1.5 via 0151b4b.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. resolution: fixed ui: CSS
Projects
None yet
Development

No branches or pull requests

6 participants