Kiosk App: Field Focus |
|||||||||||
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?
,
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.
,
May 3 2016
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...
,
May 5 2016
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.
,
May 5 2016
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.
,
May 5 2016
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.
,
Aug 2 2016
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.
,
Aug 12 2016
This is exactly the issue we're having, as well. I look forward to a definitive fix.
,
Aug 16 2016
@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
,
Dec 6 2016
rrondini, let me know if this is not fixed for you.
,
Mar 4 2017
,
Apr 17 2017
,
May 30 2017
,
Aug 1 2017
,
Sep 29 2017
,
Sep 29 2017
,
Oct 14 2017
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by aval...@chromium.org
, Apr 27 2016