Fix handling for shortcuts (#926)

It turns out that `event.key` for ctrl/cmd+Z is `z`, and it’s `Z` for
ctrl/cmd+shift+Z.

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
This commit is contained in:
Jed Fox
2023-04-20 18:32:51 -04:00
committed by GitHub
parent 131bb86711
commit e9188813fd
3 changed files with 9 additions and 3 deletions

View File

@@ -119,12 +119,12 @@ global.Actual = {
document.addEventListener('keydown', e => {
if (e.metaKey || e.ctrlKey) {
// Cmd/Ctrl+o
if (e.key === 'O') {
if (e.key === 'o') {
e.preventDefault();
window.__actionsForMenu.closeBudget();
}
// Cmd/Ctrl+z
else if (e.key === 'Z') {
else if (e.key.toLowerCase() === 'z') {
if (
e.target.tagName === 'INPUT' ||
e.target.tagName === 'TEXTAREA' ||

View File

@@ -486,7 +486,7 @@ export const CellButton = React.forwardRef(
className="cell-button"
tabIndex="0"
onKeyDown={e => {
if (e.key === 'X' || e.key === ' ') {
if (e.key === 'x' || e.key === ' ') {
e.preventDefault();
if (!disabled) {
onSelect && onSelect();

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [j-f1]
---
Fix undo keyboard shortcut being ignored