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

Popover: Popover position is not relatively calculated when using append-to=self. This causes aligment problems in a fixed element. #6616

Open
michael-stubenvoll-heller opened this issue Oct 21, 2024 · 2 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working

Comments

@michael-stubenvoll-heller

Describe the bug

When using Popover in a fixed element and setting append-to=self, the position of the Popover is calculated absolutely. This causes the Popover to appear in the wrong place. (See the reproducer) I think the solution to this problem is quite simple if you look at how this problem was solved in the Select Component:

   //Select.vue
   alignOverlay() {
            if (this.appendTo === 'self') {
                relativePosition(this.overlay, this.$el);
            } else {
                this.overlay.style.minWidth = getOuterWidth(this.$el) + 'px';
                absolutePosition(this.overlay, this.$el);
            }
        },

Here, the relative position is used to determine the position of the overlay when using appendTo=self, which results in correct positioning.

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-gak546?file=src%2FApp.vue

PrimeVue version

4.1.0

Vue version

4.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Create a fixed div element and put a Popover Component inside. Set append-to="self". Add enough content outside of the fixed element to allow for scrolling.

Expected behavior

The Popover should appear next to the target.

@michael-stubenvoll-heller michael-stubenvoll-heller added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 21, 2024
@arthaud-proust
Copy link

Hi, concerned by this issue too
It would be very helpful to append Popover to target element rather than on body

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 12, 2024
@adholland
Copy link

also interested in the resolution to this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants