Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit 5cd84ed

Browse filesBrowse files
author
Ian Macphail
committed
[[ emscripten ]] Keep hidden input field in fixed position in browser window
This patch changes the CSS style of the hidden input field used to detect input events to ensure it is kept within the visible area of the page within the browser. This change prevents the browser window from scrolling when focus is passed to the hidden field, even in browsers that don't support the 'preventScroll' passed to the Element.focus method.
1 parent ff7ce27 commit 5cd84ed
Copy full SHA for 5cd84ed

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎engine/src/em-event.js

Copy file name to clipboardExpand all lines: engine/src/em-event.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,14 @@ mergeInto(LibraryManager.library, {
114114
// Create the hidden input element
115115
var tInput = document.createElement('input');
116116
tInput.type = 'text';
117-
tInput.style.position = 'absolute';
117+
tInput.style.position = 'fixed';
118+
tInput.style.display = 'block';
118119
tInput.style.zIndex = 0;
119120
tInput.style.opacity = 0;
121+
tInput.style.setProperty('left', '0px', 'important');
122+
tInput.style.setProperty('top', '0px', 'important');
123+
tInput.style.setProperty('width', '1px', 'important');
124+
tInput.style.setProperty('height', '1px', 'important');
120125

121126
LiveCodeEvents._inputelement = tInput;
122127
document.body.appendChild(tInput);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.