SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.56k stars 267 forks source link

fix(f6 navigation): work properly when multiple runtimes #9810

Closed nnaydenow closed 2 months ago

nnaydenow commented 2 months ago

F6 navigation adds keydown handler to the body element that will move the focus to the previous / next group that has focusable element. If F6 navigation feature is enabled in multiple runtimes this handler will be attach multiple times.

With current change, we ensure that only one callback will be executed to move the focus to the correct element. This callback is coming from the latest registered runtime (newest version).

Fixes: https://github.com/SAP/ui5-webcomponents/issues/9795

2bno1 commented 2 months ago

@nnaydenow What happens if the multiple runtimes have the same version? I'm afraid all the event handlers will be executed, right?

nnaydenow commented 2 months ago

@nnaydenow What happens if the multiple runtimes have the same version? I'm afraid all the event handlers will be executed, right?

First one of the latest runtime will call stopImmediatePropagation that will prevent all other callbacks to be executed