Skip to content

Commit

Permalink
Change mousedown event on click in edit-text
Browse files Browse the repository at this point in the history
Remove some outdated styles
  • Loading branch information
SweetDealer committed Apr 19, 2024
1 parent 9bb3e1a commit 9d2a816
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elsci-io/ui-essential",
"version": "1.0.58",
"version": "1.0.59",
"description": "Material Design components created for products built by elsci.io",
"main": "src/index.js",
"type": "module",
Expand Down
7 changes: 4 additions & 3 deletions src/EditText/EditText.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export default class EditText extends HTMLElement {

#addListeners() {
this.#children.text.addEventListener("click", this.#showPopup.bind(this));
this.addEventListener('mousedown', this.#onClickOutsideOfInput.bind(this));
// Beware of "mousedown" because click event still could be triggered on the element below edit-text
this.addEventListener('click', this.#onClickOutsideOfInput.bind(this));
this.#children.popup.addEventListener('keydown', this.#onKeydown.bind(this));
this.#children.input.onInput(this.#onInput.bind(this));
this.addEventListener("cancel", this.#onEscape.bind(this));
Expand Down Expand Up @@ -108,10 +109,10 @@ export default class EditText extends HTMLElement {
}

#onClickOutsideOfInput(event) {
if (event.target !== this.#children.popup)
return;
event.preventDefault();
event.stopPropagation();
if (event.target !== this.#children.popup)
return;
if (this.#validateWithExternalValidators()) {
this.#children.popup.close();
this.#updateDisplayTextAndNotifyIfChanged();
Expand Down
5 changes: 0 additions & 5 deletions src/EditText/EditText.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ edit-text {
margin: .5rem .5rem 1rem;
}

//.edit-text__popup text-input input{
// width: 11ch;
//}

.edit-text__popup .text-input__error {
height: unset;
}
Expand All @@ -34,7 +30,6 @@ edit-text {

.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 9d2a816

Please sign in to comment.