question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PopupBox is closed after being opened

See original GitHub issue

I have a problem with the PopupBox control where it opens and then closes right away.

PopupBox-Auto-Close

I’ve seen this problem for both a simple PopupBox and a more complex scenario where a custom control has a PopupBox in its control template. The animation above demonstrates the simple scenario and the XAML for that case looks like this:

<mdt:PopupBox FocusVisualStyle="{x:Null}">
    <StackPanel>
        <Button Name="ReportProblem" Content="Report Problem..."/>
        <Separator/>
        <Button Name="Hide" Content="Hide"/>
        <Separator/>
        <Button Name="Exit" Content="Exit"/>
    </StackPanel>
</mdt:PopupBox>

In the complex scenario the content of the PopupBox has a TextBox which gets its focus set when the IsPopupOpen is changed to true. This seems to happen before PopupBox own change handler which in turn calls AnimateChildrenIn. The way I do this is through binding IsPopupOpen to another property which has a property changed handler where the focus is set. I might change to use the Opened/Closed events instead which would make the focus be set “after” PopupBox handles the property change event.

But still, the behavior is observed even for the simple scenario. That makes me think maybe something else is in play.

The problem is similar to #725 in how it behaves but not how the PopupBox properties are set. I do not make use of PopupMode="MouseOverEager"

Keeping these notes from @Keboo as a reminder of what try out during troubleshooting:

@mgnslndh thank you. A few additional questions. Are you able to share the contents of your popup box? I am wondering if perhaps some of the timing is coming into play because the AnimateChildrenIn method. I am thinking that perhaps the issue is that it attempts to move mouse capture before those storyboards have been applied. I am not sure I remember your setup exactly, but did you also have the stack trace that was occurring when the popupbox was closing? I am also wondering if perhaps there is some element (like a textbox) that is getting keyboard focus, but then dropping it when the popupbox animates on. As a simple test you might try copying in the existing PopupBox template, and renaming the PART_ to be something else so the control doesn’t find it. This should effectively turn off the animations. Also if you don’t mind opening an issue for this, that would help me keep track of it so this does not get lost.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Zanglcommented, Aug 19, 2019

@Keboo As mentioned here is the behaviour I see for the dialoghost popup on a touchscreen, 4495 is the DialogHost.AnchorBottom from the MaterialDesignInXaml.Examples solution. 4497 is the same but with the MaterialDesignEmbeddedDialogHost style added to the dialoghost. It seems like the edit box loses focus and the keyboard popup determines it is no longer required and collapses.

1298 Dialog host popup on touch.zip

1reaction
mgnslndhcommented, Aug 19, 2019

Ok, @Zangl its nice to have more people on board trying to fix this 😃 I’ve struggled with both issues for a while and finally we might be able to track down the root cause.

@Keboo Anything you want us to try, be sure to let us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popup opened by me being closed after redirect
I'm opening a popup to an external website where my users can login and get redirected to my website with a code (?code=xxxx)...
Read more >
close after clicking outside of the pop-up box
When there is a pop-up opened, we can only close it by a close action inside a button. But is there also a...
Read more >
Auto-closing the open file pop-up box
When using the Open File pop-up box to navigate around, it will sometimes randomly close a few times before I can actually type...
Read more >
Blank white pop up box displaying when Premier opens
When I hit the cross it just closes Premier. I've tried restarting, etc and it's alway the same. I believe the box is...
Read more >
Popup box – WordPress plugin
Popup everything you want! Create informative and promotional popups all in one plugin. Increase your website user engagement with eye-catching popups.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found