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

Dialog: [V4] When it non-fixed, it will cause the appendTo target shrink or joggled. #6160

Closed
wangziling opened this issue Aug 1, 2024 · 2 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@wangziling
Copy link
Contributor

wangziling commented Aug 1, 2024

Describe the bug

When the Dialog component want to be appended with the style position: absolute,
triggering it with the right or bottomRight or topRight state.

It will cause the appended target joggle or shrink.

I had used Dialog as a Drawer to let it under an position: relative element, and appeared as expanded from the right side.

Reproducer

https://stackblitz.com/edit/eud9xv-fgipqu

PrimeVue version

4.0.3

Vue version

4.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

Chrome 127.0.6533.89

Steps to reproduce the behavior

Please visit: https://stackblitz.com/edit/eud9xv-fgipqu

Then click "Right" or "TopRight" or "BottomRight".

I only add a "pt" property on the <Dialog /> component.

pt:mask:style="position: absolute;"

Expected behavior

Without the joggling.

@wangziling wangziling added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 1, 2024
@wangziling wangziling changed the title Dialog: When it non-fixed, it will cause the appendTo target shrink or joggled. Dialog: [V4] When it non-fixed, it will cause the appendTo target shrink or joggled. Aug 1, 2024
@tugcekucukoglu
Copy link
Member

The issue is not clear on our side. In the core, the mask already has position:fixed style. There is also appendTo prop available for Dialog. In which case you need to give absolute to mask.

@wangziling
Copy link
Contributor Author

wangziling commented Aug 2, 2024

The issue is not clear on our side. In the core, the mask already has position:fixed style. There is also appendTo prop available for Dialog. In which case you need to give absolute to mask.

Hi~~~

Sorry for my unclear statements~

I had already used the appendTo property and add the style position: absolute; on the dialog mask.

E.g.:

<Dialog appendTo=".drawer-anchor" position="right" pt:mask:style="position: absolute;" />

<div class="drawer-anchor" style="position: relative;">The drawer anchor</div>

I want to achieve this effect: https://www.naiveui.com/en-US/os-theme/components/drawer#target.vue

image

But after I did the efforts above,

The demo:
https://stackblitz.com/edit/g3wkhk?file=src%2FApp.vue

After click the Show btn, you will see that:

Before the Dialog showing, the content of the <Dialog>'s parent of the positioning will be squeezed to the lefside at the beginning, and then after the Dialog being shown, the parent of the positioning will be recovered.

Finally I found that seems due to invoking the focus() event ahead of the time on the transition component's @enter lifecycle hook.

image

I had raised up a PR to fix this issue: #6161 😉

@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 Aug 22, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.0.5 milestone Aug 22, 2024
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

2 participants