Skip to content

Commit 2c4d0f1

Browse files
committed
fix: improve mobile keyboard support for SplitFlapDisplay
1 parent b7099c9 commit 2c4d0f1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

frontend/src/components/SplitFlapDisplay.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const SplitFlapDisplay: React.FC<SplitFlapDisplayProps> = ({
3737
if (isInteractive && isConnected) {
3838
// Focus the hidden input to show keyboard on mobile
3939
if (hiddenInputRef.current) {
40-
hiddenInputRef.current.focus();
40+
hiddenInputRef.current.focus({
41+
preventScroll: true // Prevent page from scrolling when focusing
42+
});
4143
}
4244

4345
// Call the original onClick handler if provided
@@ -111,11 +113,11 @@ const SplitFlapDisplay: React.FC<SplitFlapDisplayProps> = ({
111113
style={{
112114
position: 'absolute',
113115
opacity: 0,
114-
height: 1,
115-
width: 1,
116+
height: '100%', // Make it cover the entire display area
117+
width: '100%', // Make it cover the entire display area
116118
left: 0,
117-
bottom: 0,
118-
pointerEvents: 'none',
119+
top: 0,
120+
pointerEvents: 'none', // This allows clicks to pass through to the display
119121
zIndex: -1
120122
}}
121123
onInput={handleHiddenInput}

0 commit comments

Comments
 (0)