refactor(FileExplorer): stop blocking event

This commit is contained in:
EnixCoda 2018-06-24 20:02:26 +08:00
parent 6c7823097b
commit be9f258be3

View file

@ -53,7 +53,6 @@ const execAfterRender = dispatch => () => {
}
const handleKeyDown = dispatch => ({ key }) => dispatch(({ visibleNodes: { nodes, focusedNode, expandedNodes, depths } }) => {
let shouldStopPropagation = true // prevent body scrolling
if (focusedNode) {
const focusedNodeIndex = nodes.indexOf(focusedNode)
switch (key) {
@ -121,8 +120,6 @@ const handleKeyDown = dispatch => ({ key }) => dispatch(({ visibleNodes: { nodes
}
break
default:
shouldStopPropagation = false
}
} else {
// now search input is focused
@ -134,17 +131,9 @@ const handleKeyDown = dispatch => ({ key }) => dispatch(({ visibleNodes: { nodes
case 'ArrowUp':
dispatch(focusNode, nodes[nodes.length - 1])
break
default:
shouldStopPropagation = false
}
} else {
shouldStopPropagation = false
}
}
if (shouldStopPropagation) {
event.stopPropagation()
event.preventDefault()
}
})
const handleSearchKeyChange = dispatch => async event => {