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

BAutoComplete arrow key selection doesn't work with computed data #247

Open
hchamre opened this issue Jun 7, 2024 · 0 comments
Open

BAutoComplete arrow key selection doesn't work with computed data #247

hchamre opened this issue Jun 7, 2024 · 0 comments
Labels
bug Something isn't working need investigation Need investigation
Milestone

Comments

@hchamre
Copy link

hchamre commented Jun 7, 2024

Overview of the problem

Buefy version: buefy-next 0.1.3
Vuejs version: 3.4.27
OS/Browser:

Description

When using a computed property as the data source for BAutoComplete, the arrow key selection doesn't work. The issue seems to be that the autocomplete component's selection variable is wrapped in a proxy, which changes how the item selected matches with those in the suggested list.

Steps to reproduce

  1. Create a computed property that returns an array of objects.
  2. Use the computed property as the data source for BAutoComplete.
  3. Try to navigate through the suggestions using the arrow keys.

Expected behavior

The arrow key selection should work as expected.

Actual behavior

The arrow key selection doesn't work:

Screen.Recording.2024-06-07.at.16.17.19.mov

Code

src/App.vue:
<script setup>
import { computed, ref } from 'vue'

function getFruits() {
  return [
    { name: 'Apple', id: 1 },
    { name: 'Banana', id: 2 },
    { name: 'Orange', id: 3 },
    { name: 'Mango', id: 4 },
    { name: 'Grapes', id: 5 }, 
  ];
}

const suggestionsAsRef = ref(getFruits());

const suggestionsAsComputed = computed(getFruits);
</script>

<template>
  <section @keydown="onKeyDown">
    <!-- works -->
    <b-field label="Suggestions as ref">
      <b-autocomplete id="autocomplete" :data="suggestionsAsRef" field="name" />
    </b-field>
    <!-- doesn't work -->
    <b-field label="Suggestions as computed">
      <b-autocomplete id="autocomplete" :data="suggestionsAsComputed" field="name" />
    </b-field>
  </section>
</template>
@wesdevpro wesdevpro added bug Something isn't working need investigation Need investigation labels Jun 7, 2024
@wesdevpro wesdevpro added this to the v0.1.5 milestone Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need investigation Need investigation
Projects
Status: 🔖 Ready
Development

No branches or pull requests

2 participants