Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sratz opened this issue Dec 10, 2024 · 0 comments
Labels
Linux/GTK Happens on Linux macOS happens on macOS

Comments

@sratz
Copy link
Member

sratz commented Dec 10, 2024

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.
@sratz sratz added the macOS happens on macOS label Dec 10, 2024
@sratz sratz changed the title [macOS] [Browser] Cannot traverse out of the browser using Tab / Shift-Tab [macOS/Linux] [Browser] Cannot traverse out of the browser using Tab / Shift-Tab Dec 10, 2024
@sratz sratz added the Linux/GTK Happens on Linux label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux/GTK Happens on Linux macOS happens on macOS
Projects
None yet
Development

No branches or pull requests

1 participant