New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 607270 link

Starred by 4 users

Issue metadata

Status: Archived
Owner:
Last visit > 30 days ago
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Kiosk App: Field Focus

Project Member Reported by aval...@chromium.org, Apr 27 2016

Issue description

<b>Version: <Kenneth, what is the frequency?></b>
OS: cros

It appears initial focus is wrong when running the page in a kiosk app, but not in a normal chromium tab.

Questions for Randy:

1. Can you provide a reduced test case of your app that reproduces this bug?
2. What kind of barcode scanner are you using? Does it just act like a keyboard?
3. What do you see in chrome://device-log under the HID heading?
4. Does this also happen on your development machine when running as an app?
5. What if you called yourInput.focus() at load time, does that fix it?



 
Status: ExternalDependency (was: Untriaged)
Originally reported in:  https://groups.google.com/a/chromium.org/d/msg/chromium-apps/-0HmGdX8N8o/kRxgf1SQCgAJ

Waiting for original reporter to add information on problem.

Comment 2 by m...@zebradog.com, Apr 27 2016

In our case, happens inside `<webview>` tag. Not an issue on pages loaded directly in a Chrome tab. Requires a call to `event.target.focus()` in the `contentload` callback to behave as expected: https://github.com/zebradog/kiosk/blob/master/src/js/browser.js#L226

Doesn't appear to be device-related, we were having this issue with a standard keyboard. 
1. We have tried several things, but here is a basic idea:

# manifest

```
{
	"manifest_version": 2,
	"version": "1.177",
	"name": "Our Kiosk",
	"description": "Internal Kiosk Application",
	"kiosk_enabled": true,
	"app": {
		"background": {
			"scripts": [
				"app.js"
			]
		}
	},
	"icons": {
		"16": "16.png",
		"128": "128.png"
	},
	"permissions": [
		"webview"
	]

}
```

# index.html

```
<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>
    <title>Time Keeper Kiosk</title>
	<style>
		#webview {
			display: flex;
			height: 100vh;
			width: 100%;
		}
	</style>
</head>

<body>
  <webview id="webview" src="http://path/to/internal/site"></webview>
</body>
</html>
```

# app.js

```
chrome.app.runtime.onLaunched.addListener(function() {

  var screenWidth = screen.width;
  var screenHeight = screen.height;


  var width = 1100;
  var height = 720;

  var options = {
    outerBounds: {
      width: screenWidth,
      height: screenHeight
    },
    bounds: {
      width: width,
      height: height
    },
    state: 'fullscreen',
    focused: true,
    id: "winner"
  }

  var callback = function() {
      win = document.getElementById("webview");
      win.target.addEventListener("contentload", function(e) {
        e.target.focus();
      }, false);

    } 

  chrome.app.window.create('index.html', options, callback);

});

```

2. MS146-4G slot reader. Yes, it is essentially a keyboard
3. USB: Device added: ...Unitech USB Keyboard...
4. Yes, the scan (or manual keyboard entry) only works after clicking on the window or hitting [tab] first
5. It doesn't seem to matter when or where or what focus is called on, I can't seem to set it at all...



Components: Internals>Sandbox>SiteIsolation
Owner: aval...@chromium.org
Status: Assigned (was: ExternalDependency)
This is very likely cause by the <webview> focus  issue 600395 . I'll update you here when the fix is in canary. You could see if that fixes your problem then.
That's great. We are very happy to see that this has attention and is being addressed. One of the things that we also tried was to capture any input to the page (served within the webview) at all via javascript. 

So, no a specific control required focus, but the browser window itself had to be made active to get the input. The same symptom was there. The tab key or a click on the screen sets the window active and everything works normally from there.
Just to clarify, this is what I mean:

```
document.addEventListener("keypress", function(key) {
	if (key.keyCode === 13) {
		console.log('detected enter');
		$scope.scan($scope.barcodeInput);
		$scope.barcodeInput = "";
	} else {
		$scope.barcodeInput += String.fromCharCode(key.keyCode);
		}
});
```

This only works if you hit [tab] first or click anywhere on the screen first. Then, keyboard and scanner work as expected.

The other scenario is putting the autofocus on a specific element (via input attribute or even on a looping js timer). That works as long as the entire document is active. Hit [tab] or click anywhere on the screen and the autofocus works just fine.
Status: ExternalDependency (was: Assigned)
Now that  issue 600395  is fixed it should show up on dev channel in a week or so.

If you'd like to verify the fix, you can also try out Chrome canary.
This is exactly the issue we're having, as well. I look forward to a definitive fix.
@Jmcgin...@shelbyed.org - Any chance you'd be willing to lend me a hand? I pretty much don't know anything about app development, but I'm having this issue, too. I'm just trying to launch a webpage and let it have focus... if you're up for helping, feel free to email directly: rrondini@haasdoor.com
Status: Fixed (was: ExternalDependency)
rrondini, let me know if this is not fixed for you.

Comment 11 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 12 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 13 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61
Components: Blink>HTML>Focus
Components: -Blink>Focus

Comment 17 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)

Sign in to add a comment