Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetDealer committed Feb 7, 2024
1 parent 8f3e3e8 commit 46ffe6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/EditText/EditText.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ export default class EditText extends HTMLElement {
#onInput(_, isValid) {
this.#isValid = isValid;
const value = this.#children.input.rawValue;
if (10 < value.length) {
if (100 < value.length) {
this.#children.input.value = this.#lastEnteredValue;
this.#isValid = this.#children.input.checkValidity();
} else {
this.#lastEnteredValue = value;
}
this.#children.input.style.width = value.length + 3 + "ch";
}

#onEscape() {
Expand Down Expand Up @@ -161,6 +162,7 @@ export default class EditText extends HTMLElement {
${minAttr}
${maxAttr}
type="${typeAttr}"
style="width: ${value.length + 3 + 'ch'}; min-width: 3rem"
></text-input>
</section>
</dialog>`;
Expand Down
1 change: 1 addition & 0 deletions src/EditText/EditText.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

.edit-text__popup .text-input--with-right-icon .text-input__input {
padding-right: 0;
width: inherit;
}

edit-text .edit-text__text {
Expand Down

0 comments on commit 46ffe6f

Please sign in to comment.