Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Cannot read properties of undefined (reading 'getElementsByTagName') #74

@anatolykopyl

Description

@anatolykopyl

Describe what you're reporting
The GMapAutocomplete component is throwing an error:

Cannot read properties of undefined (reading 'getElementsByTagName')

The error points to here:

if (_this.$slots.input) {
  const refName = _this.$slots.input()[0].props.ref
  const scopedInput = _this.$slots.input()[0].ref.i.ctx.$refs[refName]
  if (scopedInput) {
    refInput = scopedInput.$el.getElementsByTagName('input')[0]
  }
}

How can we reproduce it?
Use the GMapAutocomplete like this:

<template>
<GMapAutocomplete @place_changed="setPlace">
  <template #input="slotProps">
    <input
      ref="input"
      v-bind="slotProps"
    >
  </template>
</GMapAutocomplete>
</template>

<script setup>
import { ref } from "vue";

const input = ref();

function setPlace(event) {
  console.log(event)
}
</script>

Full reproduction available here: https://github.com/anatolykopyl/vue-google-maps-community-fork-reproduction

Device or enviroment

  • In which OS are you seeing this bug? OSX
  • What is your vue version? 3.2.47
  • What is your vue-google-maps-community-fork version? 0.3.1
├── @vitejs/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedYou can contribute with this with in any way possible

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions