-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add keyboard shortcuts for next _slide_ / previous _slide_ #1310
Comments
Agree, see slidevjs/slidev#126 for why. |
The workaround I used: diff --git a/src/App.tsx b/src/App.tsx
index 6c61dcf..781508c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,3 +1,4 @@
+import * as React from 'react';
import { styled, css } from '@pigment-css/react';
import { Template } from './Template';
import { Backdrop } from './Backdrop';
@@ -14,7 +15,10 @@ import {
Notes,
UnorderedList,
ListItem,
+ DeckContext,
+ useMousetrap,
} from 'spectacle';
import { rawTheme } from '../rawTheme';
// Slides
@@ -77,9 +81,24 @@ const transition = {
},
};
+function KeyboardShortcut() {
+ const deckContext = React.useContext(DeckContext);
+
+ useMousetrap(
+ {
+ pageup: deckContext.stepBackward,
+ pagedown: deckContext.stepForward,
+ },
+ [],
+ );
+
+ return null;
+}
+
export default function Presentation() {
return (
<Deck theme={spectacleTheme} transition={transition} template={<Template />}>
+ <KeyboardShortcut />
<Slide>
<Slide1 />
<Notes>
@@ -604,7 +623,7 @@ https://github.com/styled-components/styled-components/issues/4025
8m45s
</Notes>
</Slide> |
I am also interested in this feature! @oliviertassinari - Your workaround is great for the default view, but it does not seem to work with the presenter mode. Any thoughts or recommendations for this? |
@adorfman10 I don't recall having issues. What I used in the end: https://github.com/oliviertassinari/react-conf-2024-pigment-css/blob/29bd3f567a0b8473221f23c00ad12616ef8d495e/src/App.tsx#L105. |
The current shortcuts (left) and (right) only switch to the next or previous Step, which can be e.g. a text fading in.
Description
When there are a lot of steps in slides, navigating the deck can be quite slow.
Proposal
Add a pair of keyboard shortcuts for switching to the next or previous slide. I would suggest to pick one among:
Links / References
Further ideas
The text was updated successfully, but these errors were encountered: