Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340729

Summary: [Accessibility] Focus indicator is missing for SWT Mozilla browser on windows platform
Product: [Eclipse Project] Platform Reporter: Jun Yue Liu <liujuny>
Component: SWTAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aabbott, carolynmacleod4, va
Version: 3.6.2   
Target Milestone: 3.8 M4   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Jun Yue Liu CLA 2011-03-23 04:53:28 EDT
Build Identifier: 3.6.2 M20110210-1200

For accessibility, when user navigate to the SWT Mozilla browser widget via keyboard Tab/Shift+Tab, a dot-style rectangle is required to indicate current focus. On the other hand, we can see dot-Style rectangle on other widgets like button and tab header, or a blink caret in text input.

Reproducible: Always

Steps to Reproduce:
1. On windows platform, launch a simple SWT application with SWT Mozilla browser.
2. User keyboard to navigate to SWT Mozilla browser widget
Comment 1 Grant Gayed CLA 2011-11-21 12:37:59 EST
Stand-alone Firefox (7) shows the same behaviour, so this behaviour appears to come from the embedded control.  Pages like google.com do show focus on links, while pages like eclipse.org do not.  If you have a case where focus is shown in stand-alone Firefox but is not shown in a Mozilla-based Browser then please provide it here.  In the meantime, closing report as NOT_ECLIPSE.
Comment 2 Jun Yue Liu CLA 2011-11-21 22:27:16 EST
Hi Grant,

It is not necessary to navigate to any website. You can reproduce the problem with about:blank.  When I mentioned there is no focus indicator in above comments, I mean the dot-style rectangle around the whole browser client area, but not those around html element inside page.

I tested with Firefox3.6, 7, 8, and found that all firefox can show up a rectangle when navigate from address bar to browser client area.  But not for SWT browser.

Meanwhile, we make a workaround at our browser like below.
-------------
+	    if("win32".equals(SWT.getPlatform())){
+		    focusInListener = new Listener(){
+				public void handleEvent(Event event) {
+					try {
+						focusManager = getFocusManager();
+						int rc=0;
+						int[] retVal = new int[1];
+						rc = focusManager.GetFocusedElement(retVal);
+						if(rc != 0) return;
+						// not get the focused element
+						if(retVal[0]==0){
+							JHTMLDocument doc = (JHTMLDocument)getDocument();
+							if(doc != null){
+								JHTMLHtmlElement htmlElement = (JHTMLHtmlElement)doc.getDocumentElement();
+								if(htmlElement != null){
+									// set focus to htmlelement to let xulrunner draw the focus 
+									focusManager.SetFocus(htmlElement.getDOMNode().getAddress(), nsIFocusManager.FLAG_BYKEY);
+								}
+							}
+						}
+					} catch (Exception e) {
+						if(logger.isLoggable(Level.FINEST)){
+							logger.logp(Level.FINEST, CLZ_NAME, "DOMMozillaBrowser Focusin event", "set focus to JHTMLHtmlElement failed!");  //$NON-NLS-1$  //$NON-NLS-2$
+						}
+					}
+				}
+		    	
+		    };
+		    addListener(SWT.FocusIn, focusInListener);
+	    }
-----------------------
Comment 3 Grant Gayed CLA 2011-11-24 10:22:17 EST
Thanks for the further explaination.  This is fixed > 20111124, changes are at http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=108b9dd38cc7c1124205fb1899f8aad5ad317989 .