@@ -188,11 +188,11 @@ const CoreScroller = {
188
188
init ( ) {
189
189
this . time = 0 ;
190
190
this . lastEvent = this . keyIsDown = null ;
191
- this . installCanceEventListener ( ) ;
191
+ this . installCancelEventListener ( ) ;
192
192
} ,
193
193
194
194
// This installs listeners for events which should cancel smooth scrolling.
195
- installCanceEventListener ( ) {
195
+ installCancelEventListener ( ) {
196
196
// NOTE(smblott) With extreme keyboard configurations, Chrome sometimes does not get a keyup
197
197
// event for every keydown, in which case tapping "j" scrolls indefinitely. This appears to be a
198
198
// Chrome/OS/XOrg bug of some kind. See #1549.
@@ -201,15 +201,17 @@ const CoreScroller = {
201
201
_name : "scroller/track-key-status" ,
202
202
keydown : ( event ) => {
203
203
return handlerStack . alwaysContinueBubbling ( ( ) => {
204
- this . keyIsDown = true ;
204
+ this . keyIsDown = event . code ;
205
205
if ( ! event . repeat ) this . time += 1 ;
206
206
this . lastEvent = event ;
207
207
} ) ;
208
208
} ,
209
- keyup : ( _event ) => {
209
+ keyup : ( event ) => {
210
210
return handlerStack . alwaysContinueBubbling ( ( ) => {
211
- this . keyIsDown = false ;
212
- this . time += 1 ;
211
+ if ( event . code === this . keyIsDown ) {
212
+ this . keyIsDown = null ;
213
+ this . time += 1 ;
214
+ }
213
215
} ) ;
214
216
} ,
215
217
blur : ( event ) => {
@@ -272,7 +274,7 @@ const CoreScroller = {
272
274
let totalElapsed = 0.0 ;
273
275
let calibration = 1.0 ;
274
276
let previousTimestamp = null ;
275
- const cancelEventListener = this . installCanceEventListener ( ) ;
277
+ const cancelEventListener = this . installCancelEventListener ( ) ;
276
278
277
279
const animate = ( timestamp ) => {
278
280
if ( previousTimestamp == null ) {
0 commit comments