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

Bug 474862

Summary: Focus indicator not visible on buttons on dialog initial display
Product: [RT] RAP Reporter: John Gymer <jgymer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Gymer CLA 2015-08-13 04:38:36 EDT
When opening a Shell where the control with initial focus is a button, that button does not show the dotted line focus indicator until you mouse-over it, or tab around back to it.

Snippet:

/* DEMONSTRATES lack of focus indicator on button on initial entry issue */
package bug.snippet;

import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class Bugsy {
	Display display;
	Shell shell;
	Button button;
	
	Shell shell2;
	Button button2a;
	Button button2b;

	public void begin() {
		display = new Display();
		
		shell = new Shell(display, SWT.APPLICATION_MODAL|SWT.CLOSE);
		shell.setFullScreen(true);
		shell.setText("Primary Fullscreen Shell");
		FormLayout layout = new FormLayout();
		shell.setLayout(layout);
		
		FormData fd;
		
		button = new Button(shell, SWT.PUSH);
		button.setText("Open Dialog");
		fd = new FormData();
		fd.left = new FormAttachment(0, 10);
		fd.top = new FormAttachment(0, 90);
		fd.right = new FormAttachment(100,-10);
		fd.bottom = new FormAttachment(0, 120);
		button.setLayoutData(fd);
		button.addSelectionListener(butSelectListener);

		shell.open();
	}

	SelectionListener butSelectListener = new SelectionListener() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (e.widget.equals(button)) {
				shell2 = new Shell(display, SWT.APPLICATION_MODAL|SWT.CLOSE);
				shell2.setFullScreen(false);
				shell2.setBounds(200, 200, 400, 200);
				shell2.setText("Secondary Pop-Up Dialog Shell");
				FormLayout layout = new FormLayout();
				shell2.setLayout(layout);
				
				FormData fd;
				
				button2a = new Button(shell2, SWT.PUSH);
				button2a.setText("Close");
				fd = new FormData();
				fd.left = new FormAttachment(0, 10);
				fd.top = new FormAttachment(0, 90);
				fd.right = new FormAttachment(100,-10);
				fd.bottom = new FormAttachment(0, 120);
				button2a.setLayoutData(fd);
				button2a.addSelectionListener(butSelectListener);

				button2b = new Button(shell2, SWT.PUSH);
				button2b.setText("Another Button");
				fd = new FormData();
				fd.left = new FormAttachment(0, 10);
				fd.top = new FormAttachment(0, 130);
				fd.right = new FormAttachment(100,-10);
				fd.bottom = new FormAttachment(0, 160);
				button2b.setLayoutData(fd);
				button2b.addSelectionListener(butSelectListener);

				shell2.open();
			}
			else if (e.widget.equals(button2a)) {
				shell2.close();
				shell2.dispose();
			}
		}
	
		@Override
		public void widgetDefaultSelected(SelectionEvent e) {
		}
	};

}
Comment 1 John Gymer CLA 2015-08-13 04:39:55 EDT
snippet details... simply run the snippet - you will see a single wide button which does not show the focus indicator. Hit it to open a pop-up dialog with 2 buttons - there is no focus indicator until you mouse-over the top one.
Using Chrome Vox I can see that the button DOES have focus, but just is missing the focus indicator.
Comment 2 Ivan Furnadjiev CLA 2015-08-13 05:07:44 EDT
John, I remember that we implemented it exactly like in SWT. The focus indicator is only visible if you focus a button ONLY by tabbing. Could you check your snippet against SWT?
Comment 3 Ivan Furnadjiev CLA 2015-08-13 05:09:29 EDT
... I can't make the focus indicator to appear on mouse-over.
Comment 4 John Gymer CLA 2015-08-13 05:21:56 EDT
You're right (of course!) - SWT behaves the same.
Ivan, with the MouseOver behaviour, it looks like it was because I had an 'unusual' colour for MouseOver on buttons in the theming which made it appear like there was a Focus Indicator, but on second glance it appears you are also correct (of course!).
I'll respond to our customer who raised it with your explanation - hopefully it will be OK and we can ignore it.
Thanks, John
Comment 5 Ivan Furnadjiev CLA 2015-08-13 05:30:20 EDT
I'll close it as invalid.