fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Panel Won't Close

Open LarsLiden opened this issue 9 years ago • 26 comments

Bug Report

  • Package version(s)"office-ui-fabric-react": "^4.47.0",
  • Browser and OS versions: Chrome

Describe the issue:

I'm seeing the same (or similar) issue to Issue 930

I have a help panel that is opened by clicking on an icon on a modal. Usually it works just fine, but in certain situations, the panel will stop responding to clicks on the close icon or to a soft dismiss. The panel is being opened in exactly the same way each time. The only difference is that in the case where it doesn't work, there are two stacked models on the screen.

Specifically:

  1. Open ModalA + click on help icon on A -> Panel opens and closes fine
  2. Open ModalB -> Open ModelA -> click on same help icon -> Panel opens but won't close

LarsLiden avatar Nov 17 '17 19:11 LarsLiden

Any feedback / thoughts on this?

LarsLiden avatar Dec 05 '17 19:12 LarsLiden

Forgot to add my info last time which may help others diagnose. I tried debugging the click event and it seemed like some FocusTrapZone control was intercepting the click event and redirecting onto the element with the trap zone such as a activating a ToolTip even when you are not over the tooltip. This is why pressing Escape works to soft dismiss, but clicking on the X doesn't because keyboard events are not intercepted.

mattmazzola avatar Jan 06 '18 00:01 mattmazzola

@dagoff @zoarif mentioning you if you have tips here.

dzearing avatar Jan 07 '18 20:01 dzearing

I'm going to guess this; in scenario 2, focustrapzone in ModalA wants to pull focus back and fights the trap zone in the panel.

@dagoff on our team i believe also hit this and added support to layer trap zones, he may have ideas.

If you have a codepen to repro this, that would be helpful. I'll see if I can repro.

dzearing avatar Jan 07 '18 21:01 dzearing

Ok think i got a repro.

https://codepen.io/dzearing/pen/Rxxber

If you press enter on the "open panel" command (with keyboard), then press enter on the close icon, panel closes as expected.

If you press enter on the "open dialog" and then in the dialog, press enter on the open panel button within it, THEN the panel close button stops working. You can press escape to close it but you can't click on the close button.

It's close to what you seem to be experiencing.

dzearing avatar Jan 07 '18 21:01 dzearing

Much appreciated guys. Let me know if there is anything else I can do to be of assistance.

On Sun, Jan 7, 2018 at 1:33 PM, David Zearing [email protected] wrote:

Ok think i got a repro.

https://codepen.io/dzearing/pen/Rxxber

If you press enter on the "open panel" command (with keyboard), then press enter on the close icon, panel closes as expected.

If you press enter on the "open dialog" and then in the dialog, press enter on the open panel button within it, THEN the panel close button stops working. You can press escape to close it but you can't click on the close button.

It's close to what you seem to be experiencing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OfficeDev/office-ui-fabric-react/issues/3423#issuecomment-355854516, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOd5nGQvadq4tCvdwwoxRWrXyymHp5fks5tIThFgaJpZM4Qifds .

LarsLiden avatar Jan 08 '18 16:01 LarsLiden

Is there any update here? Does it need clearer reproduction in order for people to take action? It seems the issue was confirmed in isolation based on the code pen above, but I don't see any related PR's or labels/assignments for it to be addressed.

This is one of those issues that seems lower priority because it's rare (requires multiple modals/panes/panels visible rendered at same time); however, the severity of the bug is high because it essentially leaves the user stuck and app unusable without hard refresh or maybe getting lucky and escape key works.

I would also note, we have updated to later version: "office-ui-fabric-react": "5.61.0", and the issue still exists.

mattmazzola avatar Apr 02 '18 23:04 mattmazzola

Brian - is this already fixed with your PR for FocusTrapZone on Panels?

aditima avatar Apr 16 '18 18:04 aditima

@aditima Still present in Davids Codepen using 5.82.1, so no.

oengusmacinog-zz avatar Apr 16 '18 23:04 oengusmacinog-zz

Looks like the FocusTrapZone blocks clicks outside the Modal of the Dialog (unless you set a prop), then you click "open panel" and it opens but the FocusTrapZone of Dialog/Modal is still active, blocking the newly opened Panel's close button (not just on keyboard this breaks using mouse too).

Still working on a possible solution, I am open to ideas.

oengusmacinog-zz avatar Apr 20 '18 21:04 oengusmacinog-zz

In

office-ui-fabric-reacthttps://github.com/OfficeDev/office-ui-fabric-react/packageshttps://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-reacthttps://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/srchttps://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/componentshttps://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/FocusTrapZonehttps://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx

There are a pair of static stacks that keep track of which focustrapzone has priority. One of them is for click priority and the other is for focus priority. This is the bug. There should be only one stack and every new focustrapzone needs to be added to that stack, regardless of whether it asked to block clicks/focus or not.

Only the the focustrapzone on top of the stack should be allowed to trap focus or clicks. This shouldn’t be a large change.

From: Brian Garland [email protected] Sent: Friday, April 20, 2018 2:05 PM To: OfficeDev/office-ui-fabric-react [email protected] Cc: David Goff [email protected]; Mention [email protected] Subject: Re: [OfficeDev/office-ui-fabric-react] Panel Won't Close (#3423)

Looks like the FocusTrapZone blocks clicks outside the Modal of the Dialog (unless you set a prop), then you click "open panel" and it opens but the FocusTrapZone of Dialog/Modal is still active, blocking the newly opened Panel's close button (not just on keyboard this breaks using mouse too).

Still working on a possible solution, I am open to ideas.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-ui-fabric-react/issues/3423#issuecomment-383222157, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVlAeWEvzIvLLkssviAECuvdrti2zqPxks5tqk2EgaJpZM4Qifds.

dagoff avatar Apr 20 '18 21:04 dagoff

Ill also not Panel then Dialog stacks correctly, only in the order Dialog then Panel does it block.

oengusmacinog-zz avatar Apr 20 '18 21:04 oengusmacinog-zz

Any progress on this one? Still posing an issue for us.

LarsLiden avatar Jun 11 '18 19:06 LarsLiden

@LarsLiden So sorry for the delay here.

Hmm weird, so I did this in Panel:

        <Panel focusTrapZoneProps={{ }}

And now it works as expected... I haven't dug into why but I was playing with the code and hit this. Can you verify? I saved my example here:

https://codepen.io/dzearing/pen/Rxxber?editors=0010

@oengusmacinog fyi

dzearing avatar Jun 19 '18 16:06 dzearing

Can you verify?

I added this change to our app and it fixed a few of the cases I tested. There are a few more cases that only reproduce under error conditions that I didn't test yet, but it's still good news! Thanks.

mattmazzola avatar Jun 19 '18 18:06 mattmazzola

@dagoff or @oengusmacinog Do you have any idea why passing in empty object for focusTrapZoneProps would change the behavior?

dzearing avatar Jun 20 '18 05:06 dzearing

@dzearing I haven't been able to dig into the code yet but that seems in line with what we talked about above. There's a FocusTrapZone stack and somehow the Panel wasn't getting stacked ontop of the Dialog when open, so the FocusTrapZone for Dialog was active behind the Panel. I'm guessing by passing the empty props it is somehow saying "I'm here" and properly going on the stack.

oengusmacinog-zz avatar Jun 20 '18 23:06 oengusmacinog-zz

Could we simply default the props to an empty object?

dzearing avatar Jun 26 '18 18:06 dzearing

There are a pair of static stacks that keep track of which focustrapzone has priority. One of them is for click priority and the other is for focus priority. This is the bug. There should be only one stack and every new focustrapzone needs to be added to that stack, regardless of whether it asked to block clicks/focus or not. Only the the focustrapzone on top of the stack should be allowed to trap focus or clicks. This shouldn’t be a large change.

From: David Zearing [email protected] Sent: Tuesday, June 26, 2018 11:54 AM To: OfficeDev/office-ui-fabric-react [email protected] Cc: David Goff [email protected]; Mention [email protected] Subject: Re: [OfficeDev/office-ui-fabric-react] Panel Won't Close (#3423)

Could we simply default the props to an empty object?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-ui-fabric-react/issues/3423#issuecomment-400424466, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVlAeZldQPU-9WtXge0atIinnoSN2Uq0ks5uAoNYgaJpZM4Qifds.

dagoff avatar Jun 26 '18 19:06 dagoff

@dagoff possible for you to submit a quick fix?

dzearing avatar Jun 26 '18 19:06 dzearing