Skip to content

Commit

Permalink
Remove default keybind behavior in browser window (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImUrX authored Apr 5, 2024
1 parent 5471f5e commit f9c077e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions gui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ export default function App() {
const { l10n } = useLocalization();
const [updateFound, setUpdateFound] = useState('');
const isTauri = useIsTauri();

useEffect(() => {
const onKeydown: (arg0: KeyboardEvent) => void = function (e) {
// seems to be sufficient to prevent most default shortcuts
e.preventDefault();
};

window.addEventListener('keydown', onKeydown);
return () => window.removeEventListener('keydown', onKeydown);
}, []);

useEffect(() => {
async function fetchReleases() {
const releases = await fetch(
Expand Down
2 changes: 1 addition & 1 deletion gui/src/hooks/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useLayout<T extends HTMLElement>() {
window.removeEventListener('focus', onWindowResize);
window.removeEventListener('resize', onWindowResize);
};
});
}, []);

return {
layoutHeight,
Expand Down

0 comments on commit f9c077e

Please sign in to comment.