IgniteUI / igniteui-dockmanager

Ignite UI Dock Manager Web Component provides means to manage the layout of your application.
Other
38 stars 0 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'focus') #96

Closed SC-Serhii-Litvinov closed 3 weeks ago

SC-Serhii-Litvinov commented 5 months ago

Description

Error appears in a console during pane closing image

Steps to reproduce

We have a requirement to allow user confirm or decline pane closing. To to achieve this we subscribe to paneClose event and do call e.preventDefault().

After confirmation received we remove the pane. However if you click fast enough to thing will happen. Note not all panes will require confirmation, some will just close without any additional user interaction. It' s impossible upfront to distingue between such panes. So prevent preventDefault is called for all panes.

  1. Open few content panes
  2. All panes should be closed without requiring user interaction
  3. Try click on a pane after close button was pressed.
  4. Observe the error in the console

image The cause of an issue is code inside requestAnimationFrame. contentPanesElementMap no longer contains requested pane. The pane had already been closed.

UPDATE[17.06.2024] Sample application had been created to reproduce. In total there are three errors in this flow:

  1. handlePaneHeaderMouseDown: Cannot read properties of undefined (reading 'focus')
  2. closePane: Cannot read properties of undefined (reading 'type')
  3. bringFloatingPaneOnTop: TypeError: floatingPanes is not iterable It feels like all errors do have the same root cause

Note: in order to reproduce timing should be just right. Might not happen from the first attempt 2024-06-17_16-49-15

To reproduce: try closing Floating Pane via double clicking close button. Sample application link

Result

Uncaught TypeError: Cannot read properties of undefined (reading 'focus')

Expected result

The panel closed without errors in the console

SC-Serhii-Litvinov commented 2 months ago

Hi @gedinakova . Could you please share some details on how issue have been solved.

gedinakova commented 2 months ago

Hi @SC-Serhii-Litvinov, in essence we now make sure that after closing a floating pane we are not attempting to loop through a collection that is undefined. However, please note, that we closed this by mistake, as it will be released in the next DockManager version which should happen in the next 2 weeks.

SC-Serhii-Litvinov commented 2 months ago

You are still relying on requestAnimationFrame to process events, am I right?

gedinakova commented 2 months ago

Yes, we do, that hasn't changed.

gedinakova commented 3 weeks ago

Released in 1.15.0