-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
edgeEdge BrowserEdge Browser
Description
Describe the bug
When setting the focus to a Browser
based on Edge, before the underlying WebView2 runtime is fully initialized, the SWT layer thinks the browser is the focus control, but WebView2 does not.
As a result, e.g., tabbing is broken.
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();
}
}
}
}
Pressing TAB / Shift-TAB to reach other controls is broken.
Expected behavior
Pressing TAB / Shift-TAB should allow navigation to other controls.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
Version since
Eclipse 4.33
Workaround (or) Additional context
WebView2 runtime is initialized with delay.
Once initialized, we should consistently apply any focus request we got to the SWT control during that initialization phase.
Metadata
Metadata
Assignees
Labels
edgeEdge BrowserEdge Browser