Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions start-client/src/components/common/dependency/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ function Dialog({ onClose }) {
setSelected(0)
setQuery('')
textFocus()
requestAnimationFrame(scrollToLastAddedDependency)
}

const onKeyUp = event => {
if (event.keyCode === 91 || event.keyCode === 93 || event.keyCode === 17) {
setMultiple(false)
}

const scrollToLastAddedDependency = () => {
const wrapperElement = get(wrapper, 'current')
const addedDependencies = wrapperElement.querySelectorAll('a.added')
if (!addedDependencies.length) return
const lastAddedDependency = addedDependencies[addedDependencies.length - 1]
const wrapperRect = wrapperElement.getBoundingClientRect()
const dependencyRect = lastAddedDependency.getBoundingClientRect()
wrapperElement.scrollBy({
top: dependencyRect.top - wrapperRect.top - 40,
behavior: 'smooth'
})
}

const updateScroll = () => {
Expand All @@ -139,6 +147,12 @@ function Dialog({ onClose }) {
}
}

const onKeyUp = event => {
if (event.keyCode === 91 || event.keyCode === 93 || event.keyCode === 17) {
setMultiple(false)
}
}

const onKeyDown = event => {
if (event.keyCode === 75 && (event.ctrlKey || event.metaKey)) {
onClose()
Expand Down