-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove data-error attribute when removing errors #241
Remove data-error attribute when removing errors #241
Conversation
Currently, the attribute is not cleared which later overrides a different error message
Make CI happy
Nice one 😄 The data-error value is set by md-validate-error attribute. If you remove the data-error value, that message is gone. Brain fart: add temporary data attribute to indicate if data-error is set in code: add(element, error) { ..
// get error message from label
let msg = label.getAttribute('data-error');
if(!msg) {
// error message not set? add
label.setAttribute('data-error', errorMessage);
label.setAttribute('data-amb-tmp', 'err'); // ← temporary
} else {
// set label message into error object
error.message = msg;
}
.. remove(element, error) { ..
let label = element.querySelector('label');
if (label && label.getAttribute('data-amb-tmp')) {
label.removeAttribute('data-error');
label.removeAttribute('data-amb-tmp');
} |
Yeah... The question is should you really mix original validation with aurelia validation?.. I also don't particularly like that empty invalid controls stay |
Agree. Original validation should not be used when using aurelia validation. Remove md-validate="true" and use this css: label[data-error]:after {
-webkit-transition-property: all !important;
transition-property: all !important;
white-space: nowrap;
font-size: 0.8rem;
-webkit-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
label[data-error]:not(.active):after {
-webkit-transform: translateY(-140%);
-ms-transform: translateY(-140%);
transform: translateY(-140%);
} The error message do a little «bump» when the control get/loose focus. I would really like to know how to fix that. |
@Ullfis i don't think it's possible without removing the transitions |
I ended up with
Seems to do the job |
Should be covered by #245, right? Sorry I've lost track somehow. |
Seems like this one is a duplicate On 1 Sep 2016 3:44 AM, "Daniel Bendel" notifications@github.com wrote:
|
Currently, the attribute is not cleared which later overrides a different error message