From: Dan Brown Date: Thu, 26 Jan 2023 16:10:47 +0000 (+0000) Subject: Tweak tag list to add new row on input instead of change X-Git-Tag: v23.01~1^2~6 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/3202f96181385c7a05ca3c40f7a4566cc1a6fa7a Tweak tag list to add new row on input instead of change Prevented interferance with the user's action if they interacted with something below the tags, since a new row would be added on blur and hence shift down positions. For #3931 --- diff --git a/resources/js/components/tag-manager.js b/resources/js/components/tag-manager.js index cfbc514a0..24d340553 100644 --- a/resources/js/components/tag-manager.js +++ b/resources/js/components/tag-manager.js @@ -10,10 +10,11 @@ export class TagManager extends Component { } setupListeners() { - this.container.addEventListener('change', event => { + this.container.addEventListener('input', event => { + /** @var {AddRemoveRows} **/ const addRemoveComponent = window.$components.firstOnElement(this.addRemoveComponentEl, 'add-remove-rows'); - if (!this.hasEmptyRows()) { + if (!this.hasEmptyRows() && event.target.value) { addRemoveComponent.add(); } });