Skip to content

Commit 008141d

Browse files
committed
fix(player): keyboard display should not show empty icons
1 parent 4b0e109 commit 008141d

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

packages/react/src/components/layouts/default/icons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,5 @@ export interface DefaultLayoutIcons {
221221
SeekButton: DefaultSeekButtonIcons;
222222
DownloadButton?: DefaultDownloadButtonIcons;
223223
Menu: DefaultMenuIcons;
224-
KeyboardDisplay?: DefaultKeyboardDisplayIcons;
224+
KeyboardDisplay?: Partial<DefaultKeyboardDisplayIcons>;
225225
}

packages/react/src/components/layouts/default/ui/keyboard-display.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { DefaultKeyboardDisplayIcons } from '../icons';
1212

1313
export interface DefaultKeyboardDisplayProps
1414
extends Omit<PrimitivePropsWithRef<'div'>, 'disabled'> {
15-
icons: DefaultKeyboardDisplayIcons;
15+
icons: Partial<DefaultKeyboardDisplayIcons>;
1616
}
1717

1818
const DefaultKeyboardDisplay = React.forwardRef<HTMLElement, DefaultKeyboardDisplayProps>(
@@ -54,7 +54,7 @@ const DefaultKeyboardDisplay = React.forwardRef<HTMLElement, DefaultKeyboardDisp
5454
};
5555
}, [$lastKeyboardAction]);
5656

57-
return (
57+
return Icon ? (
5858
<Primitive.div
5959
{...props}
6060
className={className}
@@ -65,14 +65,12 @@ const DefaultKeyboardDisplay = React.forwardRef<HTMLElement, DefaultKeyboardDisp
6565
<div className="vds-kb-text">{$text}</div>
6666
</div>
6767
<div className="vds-kb-bezel" key={count}>
68-
{Icon ? (
69-
<div className="vds-kb-icon">
70-
<Icon />
71-
</div>
72-
) : null}
68+
<div className="vds-kb-icon">
69+
<Icon />
70+
</div>
7371
</div>
7472
</Primitive.div>
75-
);
73+
) : null;
7674
},
7775
);
7876

@@ -98,7 +96,7 @@ function getVolumeText(volume: number, gain: number) {
9896
return `${Math.round(volume * gain * 100)}%`;
9997
}
10098

101-
function getIcon(Icons: DefaultKeyboardDisplayIcons) {
99+
function getIcon(Icons: Partial<DefaultKeyboardDisplayIcons>) {
102100
const { $state } = useContext(mediaContext),
103101
action = $state.lastKeyboardAction()?.action;
104102
switch (action) {

packages/react/src/providers/remotion/ui/context.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22

3+
import { noop } from 'maverick.js/std';
34
import {
45
Internals,
56
type CompositionManagerContext,
@@ -59,6 +60,7 @@ export function RemotionContextProvider({
5960
unregisterFolder: () => undefined,
6061
registerComposition: () => undefined,
6162
unregisterComposition: () => undefined,
63+
updateCompositionDefaultProps: noop,
6264
currentCompositionMetadata: null,
6365
setCurrentCompositionMetadata: () => undefined,
6466
canvasContent: { type: 'composition', compositionId: REMOTION_PROVIDER_ID },

packages/vidstack/styles/player/default/keyboard.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
pointer-events: none;
8181
}
8282

83+
.vds-kb-bezel:not(:has(svg)) {
84+
display: none !important;
85+
}
86+
8387
.light .vds-kb-bezel {
8488
--default-bg: rgb(255 255 255 / 0.6);
8589
}

0 commit comments

Comments
 (0)