refs #7124 perf: avoid focus in disabled fields
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
b11462e244
commit
8a82b7ab38
|
@ -1,5 +1,9 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
import { getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
|
const filterAvailableInput = element => element.classList.contains('q-field__native') && !element.disabled
|
||||||
|
const filterAvailableText = element => element.__vueParentComponent.type.name === 'QInput' && element.__vueParentComponent?.attrs?.class !== 'vn-input-date';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const vm = getCurrentInstance();
|
const vm = getCurrentInstance();
|
||||||
|
@ -7,7 +11,7 @@ export default {
|
||||||
if (!['searchbarForm','filterPanelForm'].includes(this.$el?.id)) {
|
if (!['searchbarForm','filterPanelForm'].includes(this.$el?.id)) {
|
||||||
// AUTOFOCUS
|
// AUTOFOCUS
|
||||||
const elementsArray = Array.from(this.$el.elements);
|
const elementsArray = Array.from(this.$el.elements);
|
||||||
const firstInputElement = elementsArray.find(element => element.classList.contains('q-field__native'));
|
const firstInputElement = elementsArray.filter(filterAvailableInput).find(filterAvailableText);
|
||||||
|
|
||||||
if (firstInputElement) {
|
if (firstInputElement) {
|
||||||
firstInputElement.focus();
|
firstInputElement.focus();
|
||||||
|
|
Loading…
Reference in New Issue