Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select: throws an error with auto-filter-focus #6539

Closed
Tamas-hi opened this issue Oct 8, 2024 · 9 comments · Fixed by #6541
Closed

Select: throws an error with auto-filter-focus #6539

Tamas-hi opened this issue Oct 8, 2024 · 9 comments · Fixed by #6541
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Tamas-hi
Copy link
Contributor

Tamas-hi commented Oct 8, 2024

Describe the bug

From v 4.10, the Select component throws an error when you click out of the dropdown, when auto-filter-focus is enabled.

<PrimeVueSelect
v-model="customer"
checkmark
show-clear
filter
auto-filter-focus // this throws an error
scroll-height="20rem"
option-label="company_code"
:options="customerOptions"
:loading="customerOptionsLoading"
:disabled="customerOptionsLoading"
class="w-full"
:invalid="Boolean(errors.customer)"
v-bind="customerAttrs"

image

Reproducer

PrimeVue version

4.10

Vue version

4.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@Tamas-hi Tamas-hi added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 8, 2024
@Tamas-hi Tamas-hi changed the title Component Name: Select throws an error since newest version Select: throws an error with auto-filter-focus Oct 8, 2024
@wijzijnweb
Copy link

The pull request from @KumJungMin is for opening the select. This is about closing it.

#6546

@1Map
Copy link
Contributor

1Map commented Oct 12, 2024

The following line in your code throws an error as filterInput is null:

focus(this.$refs.filterInput.$el);

primevue/packages/primevue/src/select/Select.vue

I do not think it should try and focus on the filter during onOverlayLeave as the filterInput is not always there (null)

@intelmib
Copy link

intelmib commented Oct 15, 2024

primevue/pacotes/primevue/src/select/Select.vue

a comment there is to be resolved on line 693

this.autoFilterFocus && focus(this.$refs.filterInput.$el);

@1Map
Copy link
Contributor

1Map commented Oct 16, 2024

The following should be completely removed from onOverlayLeave as there is no need to focus on the filterInput Element during Leave.

            if (this.autoFilterFocus && this.filter) {
                this.$nextTick(() => {
                    focus(this.$refs.filterInput.$el);
                });
            }

It is only needed in onOverlayEnter

@wijzijnweb
Copy link

wijzijnweb commented Oct 22, 2024

Thought the same @1Map. Created a pull-request #6546 but they considered fixing the focus feature.
But in my opinion as well there seems no need to focus onLeave since the input isn't shown anyways.
Better to focus the document instead, but I don't think it matters.

We'll see how it will be fixed.

@1Map
Copy link
Contributor

1Map commented Nov 7, 2024

@wijzijnweb Thanks, well still not fixed in the latest version

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 12, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.2.2 milestone Nov 12, 2024
@Tamas-hi
Copy link
Contributor Author

Still in an issue in 4.2.2, can anyone else confirm it?
image

@lakkvak
Copy link

lakkvak commented Nov 15, 2024

Still in an issue in 4.2.2, can anyone else confirm it? image

yes, same

@wijzijnweb
Copy link

Can confirm, it's still an issue onLeave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants