Skip to content

Commit

Permalink
simplify usages of keydown input listener, phetsims/scenery#1445 phet…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 21, 2022
1 parent 67caa7d commit e5769d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/preferences/PreferencesTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TProperty from '../../../axon/js/TProperty.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import optionize, { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import globeSolidShape from '../../../sherpa/js/fontawesome-5/globeSolidShape.js';
import { HBox, HBoxOptions, KeyboardUtils, Node, Path, SceneryEvent } from '../../../scenery/js/imports.js';
import { HBox, HBoxOptions, KeyboardUtils, Node, Path, TInputListener } from '../../../scenery/js/imports.js';
import joist from '../joist.js';
import JoistStrings from '../JoistStrings.js';
import PreferencesType from './PreferencesType.js';
Expand Down Expand Up @@ -106,13 +106,13 @@ class PreferencesTabs extends HBox {
} );

// pdom - keyboard support to move through tabs with arrow keys
const keyboardListener = {
keydown: ( event: SceneryEvent ) => {
const keyboardListener: TInputListener = {
keydown: event => {

// reserve keyboard events for dragging to prevent default panning behavior with zoom features
event.pointer.reserveForKeyboardDrag();
},
keyup: ( event: SceneryEvent ) => {
keyup: event => {
if ( ( KeyboardUtils.isAnyKeyEvent( event.domEvent, [ KeyboardUtils.KEY_RIGHT_ARROW, KeyboardUtils.KEY_LEFT_ARROW ] ) ) ) {

// prevent "native" behavior so that Safari doesn't make an error sound with arrow keys in full screen mode
Expand Down

0 comments on commit e5769d2

Please sign in to comment.