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

Dropdown inside p-dialog element opens under p-dialog footer #1205

Closed
Vegim opened this issue Nov 4, 2016 · 31 comments
Closed

Dropdown inside p-dialog element opens under p-dialog footer #1205

Vegim opened this issue Nov 4, 2016 · 31 comments
Assignees

Comments

@Vegim
Copy link

Vegim commented Nov 4, 2016

capture

@cagataycivici
Copy link
Member

Try either appendTo="body" on dialog or allow overflow on dialog.

@ernestomar
Copy link

ernestomar commented Mar 15, 2017

Adding appendTo="body" don't solved the problem. I've added [style]="{width:'200px',position:'fixed'}" to p-dropdown but the button shows on top of dropdown.

primeng_-_ultima

@Naveen07
Copy link

@Vegim were you able to resolve this issue, I am facing similar issue with a drop down inside dialog.

@cagataycivici
Copy link
Member

Do you have any z-index for the button?

@Vegim
Copy link
Author

Vegim commented Mar 17, 2017

@Naveen07 i have tried the option appendTo=body back then but it didnt worked.

@Naveen07
Copy link

@Vegim Did you tried any other approach to get this resolved. I recently started using primeng.

@Vegim
Copy link
Author

Vegim commented Mar 17, 2017

@Naveen07 Nope, I tried just the approaches mentioned in the answer.

@Naveen07
Copy link

@cagataycivici @Vegim I was using primeng's pButton , I tried using a normal button and that fixed the issue :)

@cagataycivici
Copy link
Member

That is weird, we need to check this.

@cagataycivici cagataycivici reopened this Mar 17, 2017
@cagataycivici cagataycivici self-assigned this Mar 17, 2017
@cagataycivici cagataycivici added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Mar 17, 2017
@cagataycivici cagataycivici added this to the 4.0.RC2 milestone Mar 17, 2017
@cagataycivici
Copy link
Member

cagataycivici commented Mar 22, 2017

I'm unable to replicate;

screen shot 2017-03-22 at 11 48 02

    <p-dialog header="Godfather I" [(visible)]="display" modal="modal" width="350" responsive="true">
        <span>The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. 
           His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. 
           Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, 
           kind and benevolent to those who give respect,
           but given to ruthless violence whenever anything stands against the good of the family.</span>
           
       <p-dropdown [options]="cities" [(ngModel)]="selectedCity" placeholder="Select a City" appendTo="body" [style]="{'width':'100%'}"></p-dropdown>
    
        <p-footer>
            <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
                <button type="button" pButton icon="fa-close" (click)="display=false" label="No"></button>
                <button type="button" pButton icon="fa-check" (click)="display=false" label="Yes"></button>
                <button type="button" pButton icon="fa-close" (click)="display=false" label="No"></button>
                <button type="button" pButton icon="fa-check" (click)="display=false" label="Yes"></button>
            </div>
        </p-footer>
    </p-dialog>

Which theme are you using?

@cagataycivici cagataycivici removed this from the 4.0.RC2 milestone Mar 22, 2017
@cagataycivici cagataycivici removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Mar 22, 2017
@ernestomar
Copy link

I'm using Ultima template. I'm trying to reproduce without send my entire project. Please give more time.

@ernestomar
Copy link

Sorry cagataycivici It was my mistake. I've been adding the property:

appendTo="body"

To p-dialog instead to p-dropdown

Finally the combination (in p-dropdown):

appendTo="body" [style]="{'width':'100%'}"

Solved my problem.

@Naveen07
Copy link

Naveen07 commented Mar 23, 2017

sorry @cagataycivici thank sfor you help , I applied appendTo="body" on p-dialog instead of dropdown. the issue is resolved now. But I have a issue with multi select drop down inside p-dialog.
I was unable to select multiple values at a time from the multiselect dropdown, it gets minimized after every single selection.

this is my code
<p-dialog> <p-multiSelect appendTo = "body" [options]="Data" class="ui-grid-col-4" [style]="{width :'100%'}" > </p-multiSelect> </p-dialog>

@cagataycivici
Copy link
Member

Please create another issue for that one.

@andrei-ivanov
Copy link

Can you please update the demo page of the dialog with this info?
It was driving me crazy :)

Currently it has this section:

Overlays Inside

When dialog contents include other components with overlays such as dropdown, it is suggested to turn off the overflow of dialog content so that the overlays can be displayed outside of the dialog.

<p-dropdown [options]="cities" formControlName="selectedCity"></p-dropdown>

The example dropdown should have the appendTo="body" and an example of how to urn off the overflow of dialog content should also be added, as the way I did it didn't work, so I must have done it incorrectly: <p-dialog [contentStyle]="{'overflow': 'hidden'}">

@cagataycivici
Copy link
Member

@Mrtcndkn Please add dropdown to the demo of dialog so that we can provide an example.

@Mrtcndkn
Copy link
Contributor

Mrtcndkn commented Jun 6, 2017

@cagataycivici In progress.

@andrei-ivanov
Copy link

Maybe an example of how to turn off the overflow of dialog content too?

@Crunkelton
Copy link
Contributor

appendTo="body" on the p-dropdown fixed the issue for me.

@bhuvhi
Copy link

bhuvhi commented Jul 20, 2018

'appendTo="body" will scroll the dropdown menu along with the body/container scroll. Can this be made fixed?

@Crunkelton
Copy link
Contributor

Crunkelton commented Jul 21, 2018 via email

@hoffmast
Copy link

The appendTo option will cause the options of the dropdown to scroll with the page behind it, if the page behind it is large enough to scroll.

Using the [contentStyle]="{'overflow':'visible'}" approach fixes this, but if you have a p-footer, this will not display correctly. In this case, you need to add the following into your CSS, which is functionally equivalent to adding a "ui-g-12" class to the div which holds the footer. It may be good to modify the p-dialog so that the style of the footer (just like the style of the content) can be modified.

p-dialog /deep/ .ui-dialog-footer {
width: 100%;
float: left;
box-sizing: border-box;
padding: .5em;
}

@deveshkrsingh
Copy link

@hoffmast I am facing same issue,I have controls like dropdown/auto complete/multiselect and content of all is scrolling after using appendTo='body' with these controls and I have p-footer too.Please help how to resolve it.

@deveshkrsingh
Copy link

@hoffmast should I add appendTo='body' to these controls and do i need to add [contentStyle]="{'overflow':'visible'}" with p-dialog?Where we need to add below class and what is /deep/

p-dialog /deep/ .ui-dialog-footer

@hoffmast
Copy link

Hello @deveshkrsingh . Sorry if I was unclear. The contentStyle approach and the appendTo approach are two separate approaches; you use one or the other.

To fix your problem, you want to remove the appendTo statements but leave the contentStyle statements. In addition to having the contentStyle, you need to include the CSS (that is, the p-dialog /deep/ .ui-dialog-footer part) into whatever CSS (or SCSS) style sheet corresponds to the HTML file where you have your dialog. Using /deep/ allows you to change the styles of a class that is within a component someone else built. I do not know all the intricacies of /deep/ and know some people do not like to use it (it is technically deprecated I believe), but I do not know of any alternatives, currently.

@deveshkrsingh
Copy link

@hoffmast Thanks It worked.I have used [contentStyle]="{'overflow':'visible'}" on p-dialog and I am not using css without deep.

 .ui-dialog-footer {
  width: 100%;
  float: left;
  box-sizing: border-box;
  padding: .5em;
  }

@mayanksudden
Copy link

mayanksudden commented Apr 4, 2020

Add in css and i use in angular with nb-accordion

:host {
::ng-deep nb-accordion-item-body > div {
overflow: visible !important;
}
}

and remove appendTo from html

@Abhishek2kr
Copy link

'appendTo="body" will scroll the dropdown menu along with the body/container scroll. Can this be made fixed?

@Crunkelton Is this fixed?

@mayanksudden
Copy link

mayanksudden commented Aug 13, 2020 via email

@sreejithsrk
Copy link

'appendTo="body" is work for me but when we close the dialog using clicking the modal background, the dropdown panel still appearing in the screen, but dialog is closed

@sandeepk16
Copy link

sandeepk16 commented Feb 21, 2023

after applying appendTo="body" it's working
thank you @cagataycivici

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests