1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Merge pull request #13311 from Budibase/fix/grid-double-keypress

Fix requiring double keypress to create new rows
This commit is contained in:
Martin McKeaveney 2024-03-21 09:06:07 +00:00 committed by GitHub
commit 6ebe9782d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,16 +40,18 @@
}
}
// Handle certain key presses regardless of selection state
if (e.key === "Enter" && (e.ctrlKey || e.metaKey) && $config.canAddRows) {
e.preventDefault()
dispatch("add-row-inline")
return
}
// If nothing selected avoid processing further key presses
if (!$focusedCellId) {
if (e.key === "Tab" || e.key?.startsWith("Arrow")) {
e.preventDefault()
focusFirstCell()
} else if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
if ($config.canAddRows) {
e.preventDefault()
dispatch("add-row-inline")
}
} else if (e.key === "Delete" || e.key === "Backspace") {
if (Object.keys($selectedRows).length && $config.canDeleteRows) {
dispatch("request-bulk-delete")