Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Focus bug in Internet Explorer?(clicking outside of an active Shell removes focus from active widget in this shell.)
Focus bug in Internet Explorer? [message #1745288] Fri, 07 October 2016 10:31
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
Hi,
when trying to develop a fix for bug 398478, we found the following behavior, which can be reproduced in the RAP Workbench Demo application.

Start RAP Workbench Demo (do not maximize the Shell).
Open a new editor window.
Click in the editor /Set the focus to the editor.
Click outside of the Shell window.

Expectation:
Text Cursor should stay in the editor. The mouse click should not do anything.

Observation:
in Firefox: Works as expected

in Internet Explorer (11 on Windows 7): The text cursor vanishes. The field no longer receives key events.

Above expectation is in line with the code in
EventHandlerUtil.handleFocusedChild:

handleFocusedChild : function( target ) {
if( target.getEnabled() && !( target instanceof rwt.widgets.base.ClientDocument) ) {
rwt.widgets.util.FocusHandler.mouseFocus = true;
var root = target.getFocusRoot();
if( root ) {
var focusTarget = target;
while( !focusTarget.isFocusable() && focusTarget != root ) {
if( focusTarget instanceof rwt.widgets.MenuBar ) {
return;
}
focusTarget = focusTarget.getParent();
}
// We need to focus first and active afterwards.
// Otherwise the focus will activate another widget if the
// active one is not tabable.
rwt.event.EventHandler.setFocusRoot( root );
root.setFocusedChild( focusTarget );
root.setActiveChild( target );
}
}
},

The test for target being ClientDocument should prevent a focus change.
In fact, debugging showed, that root.setFocusedChild is not called (as expected) and that the active/focused control is not changed. Still, the focus in the IE browser is moved away from the field.

As mentioned above, I am working on a fix for several focus-related effects in connection with 398478 (click on shell titlebar removes focus from active widget in the same shell). The best I could come up with until now is the following test, which suffers from the same bug in Internet Explorer:

blockMouseFocus : function( target ) {
// test for click in Shell titlebar
if (target.getParent() instanceof rwt.widgets.base.HorizontalBoxLayout && target.getParent().getAppearance() == "window-captionbar") return true;

// additional attempt to prevent clicks on Composites/non-focussable widgets
//return (!target.getEnableElementFocus());

return false;
},

handleFocusedChild : function( target ) {
if( target.getEnabled() && !( target instanceof rwt.widgets.base.ClientDocument) && !this.blockMouseFocus(target) ) {
rwt.widgets.util.FocusHandler.mouseFocus = true;
var root = target.getFocusRoot();
if( root ) {
var focusTarget = target;
while( !focusTarget.isFocusable() && focusTarget != root ) {
if( focusTarget instanceof rwt.widgets.MenuBar ) {
return;
}
focusTarget = focusTarget.getParent();
}
// We need to focus first and active afterwards.
// Otherwise the focus will activate another widget if the
// active one is not tabable.
rwt.event.EventHandler.setFocusRoot( root );
root.setFocusedChild( focusTarget );
root.setActiveChild( target );
}
}
},

comments would be welcome.




Previous Topic:Using TypeScript for custom widget ?
Next Topic:using image resources from other plugin in css
Goto Forum:
  


Current Time: Fri Apr 26 07:05:10 GMT 2024

Powered by FUDForum. Page generated in 0.03394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top