Skip to content

Commit

Permalink
no keyCode (#28304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycw committed May 7, 2024
1 parent f1fe30d commit c78c003
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions editor/js/Script.js
Expand Up @@ -342,8 +342,7 @@ function Script( editor ) {
codemirror.on( 'keypress', function ( cm, kb ) {

if ( currentMode !== 'javascript' ) return;
const typed = String.fromCharCode( kb.which || kb.keyCode );
if ( /[\w\.]/.exec( typed ) ) {
if ( /[\w\.]/.exec( kb.key ) ) {

server.complete( cm );

Expand Down
18 changes: 9 additions & 9 deletions editor/js/libs/ui.js
Expand Up @@ -314,7 +314,7 @@ class UITextArea extends UIElement {

event.stopPropagation();

if ( event.keyCode === 9 ) {
if ( event.code === 'Tab' ) {

event.preventDefault();

Expand Down Expand Up @@ -686,19 +686,19 @@ class UINumber extends UIElement {

event.stopPropagation();

switch ( event.keyCode ) {
switch ( event.code ) {

case 13: // enter
case 'Enter':
scope.dom.blur();
break;

case 38: // up
case 'ArrowUp':
event.preventDefault();
scope.setValue( scope.getValue() + scope.nudge );
scope.dom.dispatchEvent( changeEvent );
break;

case 40: // down
case 'ArrowDown':
event.preventDefault();
scope.setValue( scope.getValue() - scope.nudge );
scope.dom.dispatchEvent( changeEvent );
Expand Down Expand Up @@ -903,19 +903,19 @@ class UIInteger extends UIElement {

event.stopPropagation();

switch ( event.keyCode ) {
switch ( event.code ) {

case 13: // enter
case 'Enter':
scope.dom.blur();
break;

case 38: // up
case 'ArrowUp':
event.preventDefault();
scope.setValue( scope.getValue() + scope.nudge );
scope.dom.dispatchEvent( changeEvent );
break;

case 40: // down
case 'ArrowDown':
event.preventDefault();
scope.setValue( scope.getValue() - scope.nudge );
scope.dom.dispatchEvent( changeEvent );
Expand Down
12 changes: 6 additions & 6 deletions editor/js/libs/ui.three.js
Expand Up @@ -271,10 +271,10 @@ class UIOutliner extends UIDiv {
// Prevent native scroll behavior
this.dom.addEventListener( 'keydown', function ( event ) {

switch ( event.keyCode ) {
switch ( event.code ) {

case 38: // up
case 40: // down
case 'ArrowUp':
case 'ArrowDown':
event.preventDefault();
event.stopPropagation();
break;
Expand All @@ -286,12 +286,12 @@ class UIOutliner extends UIDiv {
// Keybindings to support arrow navigation
this.dom.addEventListener( 'keyup', function ( event ) {

switch ( event.keyCode ) {
switch ( event.code ) {

case 38: // up
case 'ArrowUp':
scope.selectIndex( scope.selectedIndex - 1 );
break;
case 40: // down
case 'ArrowDown':
scope.selectIndex( scope.selectedIndex + 1 );
break;

Expand Down

0 comments on commit c78c003

Please sign in to comment.