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.vue - TypeError: Cannot read properties of null (reading '$el') onOverlayLeave #6545

Closed
wijzijnweb opened this issue Oct 9, 2024 · 5 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@wijzijnweb
Copy link

Describe the bug

When filter is on and autoFilterFocus as well then on closing the select it wants to focus the filterInput.
But the filterInput is null.

I don't see why filterInput needs to be focused at all when closing the select.

It's caused by this line:

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

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-ajtkvm?file=src%2Fmain.js

PrimeVue version

4.1.0

Vue version

4.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome 129.0.6668.70

Steps to reproduce the behavior

Open the select and close it by clicking next to it.

Expected behavior

Not to focus the filterInput when closing the select.

@wijzijnweb wijzijnweb 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 9, 2024
@wijzijnweb
Copy link
Author

Pull request: #6546

@wijzijnweb
Copy link
Author

Whoops, missed the issue here: #6539

@tugcekucukoglu
Copy link
Member

Duplicate

@1Map
Copy link
Contributor

1Map commented Nov 12, 2024

I see that you changed line 691 (onOverlayEnter)

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

But the problem is actually in the onOverlayLeave

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

The focus on the onOverlayLeave can be removed as there are no need to focus on the filterInput during a leave (Does not make sense)

@wijzijnweb wijzijnweb changed the title Select.vue - TypeError: Cannot read properties of null (reading '$el') on closing select Select.vue - TypeError: Cannot read properties of null (reading '$el') onOverlayLeave Nov 15, 2024
@wijzijnweb
Copy link
Author

@1Map +1.

@tugcekucukoglu Please re-evaluate this pull-request. It's not for the same issue you think it was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants