Bug 181410 - [Browser] browser steal focus on IE7
Summary: [Browser] browser steal focus on IE7
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: 3.3 RC2   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 80080 182017 187022 240109 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-06 10:14 EDT by Jeff Wu CLA
Modified: 2008-07-21 09:54 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Wu CLA 2007-04-06 10:14:42 EDT
Build ID: Eclipse 3.3 M6

Steps To Reproduce:
Use eclipse 3.3 M6 on Vista machine
1. Open "Internet Web Browser" view from eclipse show view menu.
2. Visit any website, e.g: http://www.eclipse.org
3. After it is loaded, click in the web page, make sure the focus is in the web content.
4. Click back to the URL input bar, the caret disappears, while you can still type char on the url bar.
5. If you switch to other perspective, or click with other view, and then back to the browser view, the caret is shown in URL bar again.
6. Repeat 3/4, the caret disappears again after it is out from browser widget.


More information:
-This doesn't happen with MS IE7 on WinXP sp2
Comment 1 Philipe Mulet CLA 2007-04-23 07:42:29 EDT
Are we addressing this for 3.3 ?
Comment 2 Grant Gayed CLA 2007-04-24 15:15:44 EDT
Focus does go to the text widget, but for some reason the caret disappears.  This can be reproduced with a basic OLE example:

public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout());
	final Text text = new Text(shell, SWT.BORDER);
	text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
	final OleControlSite controlSite;
	try {
		OleFrame frame = new OleFrame(shell, SWT.NONE);
		frame.setLayoutData(new GridData(GridData.FILL_BOTH));
		controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer");
		controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
	} catch (SWTError e) {
		System.out.println("Unable to open activeX control");
		return;
	}
	shell.open();
	final OleAutomation webBrowser = new OleAutomation(controlSite);
	int[] ids = webBrowser.getIDsOfNames(new String[]{"Navigate", "URL"}); 
	Variant[] rgvarg = new Variant[] {new Variant("http://www.google.com")};
	int[] rgdispidNamedArgs = new int[]{ids[1]};
	webBrowser.invoke(ids[0], rgvarg, rgdispidNamedArgs);
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	webBrowser.dispose();
	display.dispose();
}

I investigated this with SSQ and we could not determine why this is happening.  So there is currently no fix for this.
Comment 3 Philipe Mulet CLA 2007-04-26 03:40:13 EDT
Any commitment for 3.3 or still don't know ?
Comment 4 Grant Gayed CLA 2007-04-26 11:05:32 EDT
It's a "don't know".  I think Steve N. is a good candidate to look at this when he returns next week.  
Comment 5 Steve Francisco CLA 2007-05-08 12:59:23 EDT
Grant, any progress on having Steve look at this?
Comment 6 Grant Gayed CLA 2007-05-10 15:06:38 EDT
*** Bug 182017 has been marked as a duplicate of this bug. ***
Comment 7 Grant Gayed CLA 2007-05-10 15:08:19 EDT
It appears to be an IE7 issue (happens on XP or Vista), so I've updated the title accordingly.
Comment 8 Grant Gayed CLA 2007-05-11 13:26:12 EDT
This appears to be an IE7 bug, because it even happens if snippet123 ( http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java ) is modified to include a Text.  Snippet 123 does not use the Browser, but just invokes the three lines of OLE needed to open IE in place.

I looked at this with SN yesterday and we could not find a fix.  So at this point I don't think a committment for 3.3 can be made for this.
Comment 9 Michael Giroux CLA 2007-05-11 13:42:19 EDT
Is this really an issue with focus?

Bug 80080 described this same problem back in 2004 (probably IE5 days) and bug 182017 https://bugs.eclipse.org/bugs/show_bug.cgi?id=182017 started occurring with IE6.

The issue is that the text cursor is not restored when the user switches from the browser view to an editor view.  

Note that you can switch between these two views all day long and never see the problem if you do not click within the browser view window itself.  That is, if you just select the tab to switch view, then select the tab for an editor, then in this case the text cursor is displayed.  At least this is my situation described in bug 182017 which has been marked as a duplicate of this.

I believe the issue is that when the user physically clicks in the browser view, the text cursor is turned off because it is not an editable view.  Then when the user selects an editor view by clicking on a tab or other means, the text cursor is still turned off.

I do not dispute that the cursor is being turned off by the browser view, but it should be possible to force it back on when the editor view receives the focus.  

HTH

Comment 10 Steve Northover CLA 2007-05-11 15:48:55 EDT
Submit a patch.
Comment 11 Michael Giroux CLA 2007-05-11 16:04:14 EDT
(In reply to comment #10)
> Submit a patch.

It was not my intent to trivialize the problem.  I'm sure this is a tough nut to crack since it has been around for so long.  I just wanted to avoid classifying this as an IE7 issue when it might not be.

If I had any spare cycles to work on this, I would be thrilled to dig in.  
Comment 12 Grant Gayed CLA 2007-05-15 13:27:00 EDT
*** Bug 187022 has been marked as a duplicate of this bug. ***
Comment 13 Jeff Wu CLA 2007-05-16 00:43:26 EDT
(In reply to comment #10)
> Submit a patch.

Steve N. Do you have a patch for this problem? Where can we get it?
Comment 14 Steve Northover CLA 2007-05-16 08:11:51 EDT
Nope.  Grant and I will look at it today.
Comment 15 Steve Northover CLA 2007-05-23 19:48:59 EDT
Under consideration for Eclipse 3.3 RC2.
Comment 16 Grant Gayed CLA 2007-05-24 15:59:01 EDT
+1
Comment 17 Silenio Quarti CLA 2007-05-24 16:10:39 EDT
+1
Comment 18 Steve Northover CLA 2007-05-24 16:12:42 EDT
Fixed > 20070524
Comment 19 Chris Goldthorpe CLA 2007-06-29 12:18:44 EDT
*** Bug 80080 has been marked as a duplicate of this bug. ***
Comment 20 Grant Gayed CLA 2008-07-21 09:54:12 EDT
*** Bug 240109 has been marked as a duplicate of this bug. ***