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

fix(taginput): fix dropdown position when autocompleted and appended … #3865

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

francisfontoura
Copy link
Contributor

…to body

When Autocomplete is used as Taginput child, appended to body Dropdown position should be calculated from Taginput element as trigger.

Fixes #

Proposed Changes

…to body

When Autocomplete is used as Taginput child, appended to body Dropdown position should be calculated from Taginput element as trigger.
@@ -664,7 +664,7 @@ export default {
},
updateAppendToBody() {
const dropdownMenu = this.$refs.dropdown
const trigger = this.$refs.input.$el
const trigger = this.$parent.$data._isTaginput ? this.$parent.$el : this.$refs.input.$el
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this fix the positioning problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The appended to body dropdown is absolutely positioned and its bounds are calculated from const trigger element bounds. In standalone Autocomplete, align left dropdown with input makes sense, because input left bound remains fixed. But, when inside Taginput, after adding tags, the input left bound changes, causing the bug (I think this is, at least, a consistency bug, considering left position of not appended-to-body dropdown). So, it tests If it's inside Taginput (test already used inside component) and chooses right trigger accordingly.

@kikuomax
Copy link
Collaborator

@francisfontoura Could you provide any example code that reproduces the issue?

@kikuomax
Copy link
Collaborator

@francisfontoura Could you provide any example code that reproduces the issue?

I reproduced the bug with the following code and finally got your intention:

<template>
    <div>
        <b-taginput :data="tags" append-to-body autocomplete></b-taginput>
    </div>
</template>

<script>
export default {
    data() {
        return {
            tags: [
                'Apple',
                'Banana',
                'Grape',
                'Kiwifruit',
                'Mango',
                'Orange',
                'Pineapple'
            ]
        }
    }
}
</script>

Copy link
Collaborator

@kikuomax kikuomax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed the bug fix.

@kikuomax kikuomax merged commit 703018e into buefy:dev Nov 20, 2023
@francisfontoura francisfontoura deleted the patch-1 branch November 20, 2023 15:06
kikuomax pushed a commit to kikuomax/buefy that referenced this pull request Jan 10, 2024
…to body (buefy#3865)

When Autocomplete is used as Taginput child, appended to body Dropdown position should be calculated from Taginput element as trigger.
kikuomax pushed a commit to kikuomax/buefy that referenced this pull request Feb 11, 2024
…to body (buefy#3865)

When Autocomplete is used as Taginput child, appended to body Dropdown position should be calculated from Taginput element as trigger.
kikuomax pushed a commit to ntohq/buefy-next that referenced this pull request Feb 12, 2024
…to body (buefy#3865)

When Autocomplete is used as Taginput child, appended to body Dropdown position should be calculated from Taginput element as trigger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants