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 unexpectedly renders overlay when it is actually closed #2696

Closed
pavelkornev opened this issue Jan 16, 2021 · 3 comments · Fixed by #2799
Closed

Dialog unexpectedly renders overlay when it is actually closed #2696

pavelkornev opened this issue Jan 16, 2021 · 3 comments · Fixed by #2799
Assignees
Labels
bug This issue is a bug in the code Medium Prio TOPIC RD

Comments

@pavelkornev
Copy link
Member

Describe the bug
While having a Dialog component in closed state, if we trying to get a dom ref of the overlay, the overlay gets rendered (this is fine), but it also becomes unexpectedly visible with a closed dialog at the same time.

Isolated example
https://codesandbox.io/s/ui5-webcomponents-forked-r5wfq?file=/src/index.js
As it shown in this example, I try to get a staticAreaItemDomRef via public API:
https://github.com/SAP/ui5-webcomponents/blob/master/packages/base/src/UI5Element.js#L896-L901
In order to attach listener on the overlay to close Dialog component on click. It's unexpected that overlay is shown when dialog is actually closed.

Expected behavior
hidden attributed should not be removed from the overlay when getting its DOM reference.

Screenshots
Screen Shot 2021-01-16 at 22 56 39

Affected components

  • Dialog

Organization: SAP Graph

Priority: Medium

@Martotko Martotko self-assigned this Jan 18, 2021
@Martotko
Copy link
Contributor

Martotko commented Jan 18, 2021

Hi @pavelkornev,

I've checked the example and it's not reproducible. The overlay is rendered with the "hidden" class when the dialog is in a closed state.
Screen Shot 2021-01-18 at 10 51 57

Please explain in details how to reproduce it.

Best regards,
Martin

@pavelkornev
Copy link
Member Author

pavelkornev commented Jan 18, 2021

@Martotko in order to reproduce it, you need just open the provided link.

Once you open it — the grey transparent background is an overlay which should not be visible since dialog is not open.

Please also try to disable this code in src/index.js and compare rendering results of the page:

dialog.getStaticAreaItemDomRef().then((overlayRef) => {
  overlayRef.addEventListener("click", () => dialog.close());
});

@Martotko Martotko added bug This issue is a bug in the code TOPIC RD Medium Prio and removed author action labels Jan 18, 2021
@Martotko Martotko removed their assignment Jan 18, 2021
@Martotko
Copy link
Contributor

Martotko commented Jan 18, 2021

Hello @ui5-webcomponents-topic-rd, I am forwarding this issue to you, because the issue is caused by the following code:

dialog.getStaticAreaItemDomRef().then((overlayRef) => {
overlayRef.addEventListener("click", () => dialog.close());
});

The overlay is visible initially with this code in place and everything behind the dialog button is grey.

Best regards,
Martin

@dimovpetar dimovpetar self-assigned this Feb 8, 2021
ilhan007 pushed a commit that referenced this issue Feb 9, 2021
…2799)

The block layer is created when #getStaticAreaItemDomRef is called,
but the attribute "hidden" is not set at that time. Now it's set
on onEnterDOM hook, unless the popup is already opened.

Fixes: #2696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code Medium Prio TOPIC RD
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

3 participants