I notice that if the width of my custom Polymer 1.x element is narrower than the width of the validation error message on a paper-input element, the error overflows beyond the right border of the custom element. See graphic below:
Is there a mechanism to prevent the overflow eg wrapping the text when it reaches the border of the custom element?
Thanks
<dom-module id='app-element'>
<template>
<style>
/* this style is only to reproduce the problem */
:host {
display: block;
width: 60px;
height: 100px;
border: 3px solid green;
}
You can clip the too long text by specifying a width
:root {
--paper-input-error: {
/*-o-text-overflow: ellipsis; // or clip*/
/*text-overflow: ellipsis; // or clip */
width: 60px;
};
--paper-input-container-invalid-color: orange;
}
this way the width is adjusted dynamically but might break other things (no idea)
:root {
--paper-input-container: {
position: relative;
};
--paper-input-error: {
position: absolute;
width: 100%;
}
}
or make it break like
:root {
--paper-input-error: {
position: relative; // or width: 60px;
height: 50px;
white-space: normal;
word-wrap: break-word;
line-height: initial;
};
}
the rest of the elements markup
</style>
<paper-input label="only type letters (auto-validate)" auto-validate pattern="[0-9]*" error-message="Only digits from (0 to 9) are allowed."></paper-input>
</template>
</dom-module>
I also tried to add a custom add-on instead of the default <error-element>
, but failed (see also https://github.com/PolymerElements/paper-input/issues/262#issuecomment-160109256)