support icon indicating copy to clipboard operation
support copied to clipboard

[SALESFORCE] Keyboard navigation is broken in Scheduler and Gantt

Open chuckn0rris opened this issue 1 year ago • 4 comments

Forum post

Hello there!

We have been investigating an old issue with using arrow keys to navigate tasks in Scheduler and Gantt. Pressing down/up key would skip a row, pressing right/left would not select past the first couple of tasks.

The behaviour is consistent in both Locker Service and Lightning Web Security.

1-current-behaviour-locker-and-lws.gif

We have narrowed it down to the wrap() function used by the EventHelper.fixEvent() override, yet still unsure how exactly does it cause this issue.

Removing the wrap() function fixes keyboard navigation, but introduces two new issues. Both issues are only observed in Locker, not in LWS.

The first one is an uncaught exception being thrown when pressing the Spacebar key to show a context menu.

2-no-wrap-locker-context-menu.gif

The second one is another uncaught exception thrown when double-clicking a task in Scheduler Pro or Gantt after focusing another Bryntum widget in a separate Salesforce tab.

3-no-wrap-locker-task-edit-after-focus.gif

The second issue can be resolved by completely removing the fixEvent() override. It seems that the new event management logic in v6 works just fine without it.

The first issue is also fixable, it requires removal of the contextMenuKeyEvent variable and the conditional code that is using it from ContextMenuBase.onElementEvent() method. The event parameter passed into the onElementEvent() method is already an instance of MouseEvent with type="contextmenu", so creation of a new mouse event is unnecessary. Removing this code is safe as it has no impact on the context menu functionality outside of the Salesforce platform.

Thanks 1-current-behaviour-locker-and-lws.gif 2-no-wrap-locker-context-menu.gif 3-no-wrap-locker-task-edit-after-focus.gif

chuckn0rris avatar Jan 13 '25 18:01 chuckn0rris

Hello there! Is there any progress on this ticket?

I did some performance testing in Chrome DevTools earlier today and noticed a Forced Reflow insight in the sidebar.

Turns out, the fixEvent() override may cause style recalculation, which causes UI performance degradation.

Image

It seems that by fixing this issue you would be hitting two birds with one stone!

amurashincertinia avatar Apr 09 '25 20:04 amurashincertinia

Hi Aleksei! I am working on a ticket. The problem is that removing that code breaks context menu and some drag behaviour. This is that delayed this fix a bit.

chuckn0rris avatar Apr 18 '25 15:04 chuckn0rris

Interesting... I did test this both on and off Salesforce and the context menu worked for me. Did not try dragging though. I will look into this later.

Thanks!

amurashincertinia avatar Apr 18 '25 15:04 amurashincertinia

I was found a cause of the problem with context menu (my fault, deleted more than required). DND issue you can see in Drag from grid demo, just FYI

chuckn0rris avatar Apr 20 '25 19:04 chuckn0rris

Hi Alexey, sorry for the late response.

I added the drag-from-grid demo to my Salesforce preview org setup but did not notice any issues with drag-and-drop with or without those changes.

I did, however, spot an issue with the context menu. I'm not sure if this is the issue that you also saw, but it is reproducible in the latest available version 6.2.3. The issue is that the context menu displayed in the event view is incorrect: it's the resource menu, not event menu. So it looks like a new unrelated bug.

In any case, I see that this ticket is marked as "ready for review", so I'm looking forward to test it once released.

amurashincertinia avatar Jun 02 '25 17:06 amurashincertinia

FYI: I figured out the issue I saw with the context menu. https://github.com/bryntum/support/issues/11432

amurashincertinia avatar Jun 03 '25 19:06 amurashincertinia

Thank you for updates @amurashincertinia! I am finishing with tests and will release the branch soon.

chuckn0rris avatar Jun 04 '25 11:06 chuckn0rris