fix: prevent default action when activating "Import Backup" by keyboard

This commit is contained in:
VardanHakobyan
2021-06-17 13:57:00 +04:00
parent 374e9c0616
commit 33082fcd7a

View File

@@ -107,10 +107,9 @@ const DataBackup = observer(({
if (code !== 'Enter' && code !== 'Space') {
return;
}
// In case "space" is pressed, don't allow scrolling
if (code === 'Space') {
event.preventDefault();
}
// Don't proceed the event's default action
// (like scrolling in case the "space" key is pressed)
event.preventDefault();
}
(fileInputRef.current as HTMLInputElement).click();
@@ -150,6 +149,7 @@ const DataBackup = observer(({
<div className="flex">
<button className="sn-button small info" onClick={downloadDataArchive}>Download Backup</button>
<button
type="button"
className="sn-button small flex items-center info ml-2"
tabIndex={0}
onClick={handleImportFile}