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

p-calendar in p-dialog with touchUI=true and inline=true clicking year and dismissing modal raises errors #11649

Closed
pete-mcwilliams opened this issue Jun 23, 2022 · 0 comments · Fixed by #11653

Comments

@pete-mcwilliams
Copy link
Contributor

Describe the bug

p-calendar with touchUI = true and inline=true whilst in a p-dialog errors.

element passed in is undefined

    enableModality(element) {
        if (!this.mask) {
            this.mask = document.createElement('div');
            this.mask.style.zIndex = String(parseInt(element.style.zIndex) - 1);
            let maskStyleClass = 'p-component-overlay p-datepicker-mask p-datepicker-mask-scrollblocker p-component-overlay p-component-overlay-enter';
            DomHandler.addMultipleClasses(this.mask, maskStyleClass);
            this.maskClickListener = this.renderer.listen(this.mask, 'click', (event) => {
                this.disableModality();
            });
            document.body.appendChild(this.mask);
            DomHandler.addClass(document.body, 'p-overflow-hidden');
        }
    }

dismissing modal rasies an error on this line

  destroyMask() {
    document.body.removeChild(this.mask);
    <snip>
  }

Environment

See stackblitz, versions below copied from that, we are using later versions of angular and prime where the issue still exists
"primeng": "^13.4.1",
"@angular/core": "13.3.4",

Reproducer

https://stackblitz.com/edit/github-bpugx2?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts

Angular version

13.0.3

PrimeNG version

13.3.3

Build / Runtime

Angular CLI App

Language

ES6

Node version (for AoT issues node --version)

n/a

Browser(s)

chrome

Steps to reproduce the behavior

See stackblitz:
click the year, see error in console.

  • Error: Cannot read properties of undefined (reading 'style')
    Dismiss dialog by clicking in mask, see error in console.
  • Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Expected behavior

no errors

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

Successfully merging a pull request may close this issue.

1 participant