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

Dynamic Dialog: Prevent scroll to top when child dialog closes in parent dialog #16024

Closed
singhpawank opened this issue Jul 14, 2024 · 3 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@singhpawank
Copy link

Describe the bug

I have nested dialogs using primeng dialog service, I set focusOnShow false. When I closes dialog B inside dialog A, dialog A's component scrolled to top and first focusable element receives focus. How to prevent it.

private defaultOverlayConfig:DynamicDialogConfig = {
    data:{},
    showHeader:false,
    closable:false,
    height:'100%',
    width:'100%',
    focusOnShow:false,
    focusTrap:false,
    style: { height:'100%', 'max-height':'100%', 'border-radius':'0', 'box-shadow':'none'},
    contentStyle:{height:'100%', padding:'0px', margin:'0px', 'border-radius':'0'},
    maskStyleClass:'overlay-mask-style',
    appendTo:document.getElementById('overlay'),
    transitionOptions: '0ms linear'
   }

Environment

"dependencies": {
    "@angular/animations": "^17.3.0",
    "@angular/common": "^17.3.0",
    "@angular/compiler": "^17.3.7",
    "@angular/core": "^17.3.0",
    "@angular/platform-browser": "^17.3.0",
    "@angular/platform-browser-dynamic": "^17.3.0",
    "@ngx-translate/core": "^15.0.0",
    "primeng": "^17.15.0",
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^17.3.6",
    "@angular/cli": "^17.3.6",
    "@angular/compiler-cli": "^17.3.0",
    "typescript": "~5.4.2"
  }

Reproducer

No response

Angular version

17.3.0

PrimeNG version

17.15.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.13.0

Browser(s)

Version 126.0.6478.127

Steps to reproduce the behavior

No response

Expected behavior

When dialog B closes I want parent dialog A's scroll position as it was before opening dialog B.

@singhpawank singhpawank added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 14, 2024
@singhpawank
Copy link
Author

I added pButton to first button in the component inside dialog A(parent dialog) and this behavior stopped.

<p-button pButton class="back-button" icon="pi pi-arrow-left" (onClick)="goBack()"/>

@jonnomk
Copy link

jonnomk commented Jul 30, 2024

This isn't a fix though. I don't think the dialog should be trying to automatically give focus to anything on close. I upgraded to PrimeNG version 17.18.6 from version 15. It didn't do this previously.

@mertsincan
Copy link
Member

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap?

Thanks a lot for your understanding!
Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants