Skip to content

[macOS/Linux] [Browser] Cannot traverse out of the browser using Tab / Shift-Tab #1644

Open
@sratz

Description

@sratz

Describe the bug
It is not possible to traverse out of the WebKit browser using Tab / Shift-Tab.

To Reproduce

import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class FocusProblem {

	public static void main(String[] args) {
		Shell shell = new Shell(Display.getDefault());
		shell.setLayout(new GridLayout(1, true));
		Browser browser = new Browser(shell, SWT.EDGE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(browser);
		browser.setText("browser");
		Button button = new Button(shell, SWT.PUSH);
		button.setText("button - try to reach me via keyboard!");
		Text text = new Text(shell, SWT.NONE);
		text.setText("text - try to reach me via keyboard!");
		GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
		shell.open();
		browser.forceFocus();
		while (!shell.isDisposed()) {
			if (!shell.getDisplay().readAndDispatch()) {
				shell.getDisplay().sleep();
			}
		}
	}
}

It's not possible to use Tab / Shift-Tab to navigate away from the browser to the Button or Text.

Expected behavior
Traverse listeners should work

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Noticed by adding test for Edge: Focus is lost when Browser is made the focus control immediately after construction #1640.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linux/GTKHappens on LinuxmacOShappens on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions