Skip to content

Commit 957b62c

Browse files
committed
fix(keyboard): trigger switch event again
1 parent f3a309c commit 957b62c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/dispatcher.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,9 @@ export default class Dispatcher {
173173
setTimeout(() => {
174174
var newCursor = this.selectionWatcher.forceCursor()
175175
if (newCursor.equals(cursor)) {
176-
event.preventDefault()
177-
event.stopPropagation()
178176
this.notify('switch', element, direction, newCursor)
179177
}
180-
}, 0)
178+
})
181179
}
182180

183181
/**
@@ -205,15 +203,21 @@ export default class Dispatcher {
205203
const self = this
206204

207205
this.keyboard
208-
.on('left up', function (event) {
206+
.on('up', function (event) {
207+
self.dispatchSwitchEvent(event, this, 'before')
208+
})
209+
210+
.on('left', function (event) {
209211
self.dispatchSwitchEvent(event, this, 'before')
210212
})
211213

212-
.on('right down', function (event) {
214+
.on('right', function (event) {
213215
self.dispatchSwitchEvent(event, this, 'after')
214216
})
215217

216-
.on('tab shiftTab esc', () => {})
218+
.on('down', function (event) {
219+
self.dispatchSwitchEvent(event, this, 'after')
220+
})
217221

218222
.on('backspace', function (event) {
219223
const range = self.selectionWatcher.getFreshRange()

0 commit comments

Comments
 (0)