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

Cannot read property 'blur' of undefined #1421

Closed
muhammadbima20 opened this issue Apr 22, 2021 · 8 comments · Fixed by #1497
Closed

Cannot read property 'blur' of undefined #1421

muhammadbima20 opened this issue Apr 22, 2021 · 8 comments · Fixed by #1497

Comments

@muhammadbima20
Copy link

Hi there, i have a problem while using vue-multiselect, i use nuxtjs, and vue-multiselect v2.1.6 and the problem or bugs i found is :

i got an error when i focused / open the select option this multiselect, and then try to redirect to previous page using back button in my chrome, the error message is :

Cannot read property 'blur' of undefined

the only thread i found for fixing my problem said that i have to write this one :

beforeDestroy(){ this.$refs.myMultiSelect.deactivate(); },

but still got an error Cannot read property 'blur' of undefined and a new one : TypeError: Cannot read property 'deactivate' of undefined

so what should i do for fixing my problem ? any help will be very appreciated.
Thanks!

@shentao
Copy link
Owner

shentao commented May 3, 2021

Thanks for reporting!

@anilsonlopes-zz
Copy link

You need replace myMultiSelect for used ref on element.

@mylesboone
Copy link
Contributor

Looks like ln 677 of multiselectMixin.js

      if (this.searchable) {
        this.$refs.search && this.$refs.search.blur()
      } else {
        this.$el.blur()
      }

ends up compiling to

this.searchable?this.$refs.search.blur():this.$el.blur()

@atilkan
Copy link

atilkan commented Apr 27, 2022

Is there any chance of fixing this?

@shentao
Copy link
Owner

shentao commented Apr 27, 2022

@atilkan if you could help me verify if the linked PR works, then I could try to release that fix in the next 2 weeks.

@Namstel
Copy link
Contributor

Namstel commented Apr 28, 2022

I myself am running into problems using optional chaining. See:
#1497 (comment)

@mylesboone
Copy link
Contributor

@shentao would you be willing to look at #1497 and merge if you approve?

@Namstel
Copy link
Contributor

Namstel commented Jun 11, 2022

@atilkan if you could help me verify if the linked PR works, then I could try to release that fix in the next 2 weeks.

I looked at it and I can verify that the changes made in the linked PR work.

@mattelen mattelen added this to the 2.1.7 release milestone Oct 27, 2022
@akki-jat akki-jat self-assigned this Oct 27, 2022
@akki-jat akki-jat removed their assignment Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants