zowe / zlux

The top-level superproject for zLUX. zLUX includes the Zowe Desktop framework in addition to several built-in apps and an example server implementation.
Eclipse Public License 2.0
39 stars 42 forks source link

IFrame app Focus lost when mouse leaves IFrame boundary #112

Open jordanCain opened 5 years ago

jordanCain commented 5 years ago

When using an iframe plugin such as the sample IFrame app if a user is selected on a text field or any input element and then their mouse leaves the boundary of the app the focus on the selected element is lost. This behaviour is not present in the other two sample apps.

A user scenario could be they're typing in a text field and knock their mouse accidentally and then the focus on the field they were typing in is lost.

This is not an ideal user experience.

1000TurquoisePogs commented 5 years ago

Confirmed! You're right, we need to fix this. I suspect this is due to the handling or lack of handling of events from the iframe plugin factory: https://github.com/zowe/zlux-app-manager/tree/master/virtual-desktop/src/app/plugin-manager/plugin-factory/iframe

As an architectural note, any framework can exist within the desktop so long as its factory solves all encapsulation, event handling, and context-passing problems. Seems that the iframe factory may be failing some of its event handling responsibilities.

DivergentEuropeans commented 5 years ago

This is a consequence of the detection of an iframe in the first place. An iframe becomes hard to detect as a mouse event, other than the fact that when you click on an iframe, you lose focus on the original desktop element (this trigger's a "blur" event). The problem arises when without this, you can't at the moment detect clicks from an iframe to an iframe app (say you had multiple instances of the iframe open) is that the focus is not lost going from iframe to iframe, so the blur event doesn't fire, which is why the current logic is set to lose focus when the mouse leaves the app (so that blur trigger can be reset so we again check when a user has clicked on an iframe). There will have to be logic added in to account for this, maybe a better way of detecting iframes seeing as there is a limitation to what Javascript can do, or maybe logic to do things differently for going from iframe to iframe/iframe to desktop.