Skip to content

Conversation

@jcjp
Copy link
Contributor

@jcjp jcjp commented Apr 7, 2025

Description

Reduce the number of reposition to a max of 2, if we only set it to 1 it will be a little off the mark with the correct position and size. This is to prevent infinite reposition, and to make it settle to a certain location after the max retries we need to pass a location to the child VMenu for example :menu-props={ location: "top"} after 2 tries of reposition and resizing it will settle at the top. See the example here: #21098.

If you guys are okay with this enhancement or you have a better idea on how to tackle this problem let me know thanks!

On this VPlay add the location: "top" to see and test.

<template>
  <v-app>
    <div>
      <v-select
        label="Location"
        v-model="location"
        :items="[
          'bottom','top' ,'center' ,'end' ,'left' ,'right' ,'start' ,'bottom top' ,'bottom center' ,'bottom end',
          'bottom left' ,'bottom right' ,'bottom start' ,'top center' ,'top end' ,'top left' ,'top right',
          'top start' ,'center end' ,'center left' ,'center right' ,'center start' ,'end left' ,'end right',
          'end start' ,'left right' ,'left start' ,'right start'
        ]"
      />
    </div>

    <div class="container">
      lorem<br />
      ipsum<br />
      lorem<br />
      ipsum<br />
      {{ location }}<br />
      This select menu should flicker on chrome browser:<br />

      <div id="select-wrapper">
        <v-select
          label="Select"
          :items="['California', 'Colorado']"
          :menu-props="{ attach: '#select-wrapper', location: location }"
        />
      </div>
    </div>
  </v-app>
</template>

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

const location = ref(null)
</script>

<style>
  .container {
    width: 500px;
    height: 280px;
    border: 1px solid grey;
    overflow-y: auto;
  }

  #select-wrapper {
    position: relative;
  }
</style>

@jcjp jcjp added the T: enhancement Functionality that enhances existing features label Apr 7, 2025
@jcjp jcjp requested review from KaelWD, Spatlani and johnleider April 7, 2025 16:35
@jcjp jcjp self-assigned this Apr 7, 2025
@johnleider
Copy link
Member

Checking the docs on mobile, the first thing I ran into was this:

Current:
image

This P.R.
image

Every menu example I came across exhibited some form of this behavior.

@jcjp
Copy link
Contributor Author

jcjp commented Apr 11, 2025

Every menu example I came across exhibited some form of this behavior.

John what are you using for testing? I ran the docs locally and test out VSelect, VMenu, VAutocomplete and VCombobox. Do you think it might be cache? I did re-install my node modules.

We might need more pair of eyes on to check on this.

@johnleider
Copy link
Member

Did you build Vuetify before running the docs?

@jcjp jcjp requested a review from johnleider April 18, 2025 16:39
@jcjp jcjp dismissed johnleider’s stale review April 18, 2025 16:40

John I have updated this and checked using the build command that we discussed, let me know if there are still problems.

jcjp added 8 commits April 19, 2025 21:11
fix(location-strategies): partially fix bug #20515
fix(location-strategies): set max retry to 2
fix(location-strategies): save the last x and y position
fix(location-strategies): add comments
fix(location-strategies): remove unnecessary code
fix(location-strategies): move increment of retries inside the function
fix(location-strategies): increase retries to x3
@jcjp jcjp force-pushed the fix(location-strategies)/v-select-flicker branch from 0a766f4 to 7c53e68 Compare April 19, 2025 13:12
@KaelWD
Copy link
Member

KaelWD commented Apr 23, 2025

Different approach that only checks for flipping in the resize observer and doesn't potentially introduce another infinite loop by unterminated while (true): #21300

@jcjp
Copy link
Contributor Author

jcjp commented Apr 25, 2025

Close this PR to a more better solution from Kael.

@jcjp jcjp closed this Apr 25, 2025
@johnleider johnleider deleted the fix(location-strategies)/v-select-flicker branch April 26, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T: enhancement Functionality that enhances existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants