From a27ac46f9f4a382ed9a2cc1803bb2d88882df8e4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 26 Jul 2024 06:21:39 +0200 Subject: [PATCH] fix: disable firstInput.focus --- src/boot/qformMixin.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index 54edfb60b..85d0c7c10 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -3,28 +3,29 @@ import { getCurrentInstance } from 'vue'; const filterAvailableInput = (element) => { return element.classList.contains('q-field__native') && !element.disabled; }; -const filterAvailableText = (element) => { - const parentComponent = element.__vueParentComponent; - if (!parentComponent) return element.attributes.component.nodeValue !== 'input'; - return ( - parentComponent?.type.name === 'QInput' && - parentComponent?.attrs?.class !== 'vn-input-date' - ); -}; +// const filterAvailableText = (element) => { +// const parentComponent = element.__vueParentComponent; +// if (!parentComponent) +// return element.attributes.component.nodeValue !== 'input'; +// return ( +// parentComponent?.type.name === 'QInput' && +// parentComponent?.attrs?.class !== 'vn-input-date' +// ); +// }; export default { mounted: function () { const vm = getCurrentInstance(); if (vm.type.name === 'QForm') { if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { - // AUTOFOCUS - const elementsArray = Array.from(this.$el.elements); - const availableInputs = elementsArray.filter(filterAvailableInput); - const firstInputElement = availableInputs.find(filterAvailableText); + // TODO: AUTOFOCUS IS NOT FOCUSING + // const elementsArray = Array.from(this.$el.elements); + // const availableInputs = elementsArray.filter(filterAvailableInput); + // const firstInputElement = availableInputs.find(filterAvailableText); - if (firstInputElement) { - firstInputElement.focus(); - } + // if (firstInputElement) { + // firstInputElement.focus(); + // } const that = this; this.$el.addEventListener('keyup', function (evt) { if (evt.key === 'Enter') {