Skip to content

Commit

Permalink
typecast as KeyboardEvent, phetsims/scenery#1340
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 8, 2022
1 parent a18ba9c commit b15d3f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions js/accessibility/AccessibleNumberSpinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ const AccessibleNumberSpinner = <SuperType extends Constructor>( Type: SuperType
// check for relevant keys here
if ( KeyboardUtils.isRangeKey( event.domEvent ) ) {

// TODO: How to specify subtypes of DOMEvents, https://github.com/phetsims/scenery/issues/1340
const domEvent = event.domEvent! as Event & { metaKey: boolean };
const domEvent = event.domEvent! as KeyboardEvent;

// If the meta key is down we will not even call the keydown listener of the supertype, so we need
// to be sure that default behavior is prevented so we don't receive `input` and `change` events.
Expand Down
3 changes: 1 addition & 2 deletions js/accessibility/AccessibleValueHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,7 @@ const AccessibleValueHandler = <SuperType extends Constructor>( Type: SuperType,
*/
handleKeyDown( event: SceneryEvent ) {

// TODO: How to specify subtypes of DOMEvents, https://github.com/phetsims/scenery/issues/1340
const domEvent = event.domEvent as Event & { shiftKey: boolean, metaKey: boolean };
const domEvent = event.domEvent as KeyboardEvent;

const key = KeyboardUtils.getEventCode( domEvent );

Expand Down

0 comments on commit b15d3f7

Please sign in to comment.