Fix dialog focus
This commit is contained in:
@@ -10,11 +10,12 @@
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { Box, Text, useInput } from 'ink';
|
||||
import { Box, Text } from 'ink';
|
||||
import { InputDialog } from '../../components/Dialog.js';
|
||||
import { ScrollableList, type ListItemData, type ListGroup } from '../../components/List.js';
|
||||
import { useNavigation } from '../../hooks/useNavigation.js';
|
||||
import { useAppContext, useStatus } from '../../hooks/useAppContext.js';
|
||||
import { useBlockableInput, useIsInputCaptured } from '../../hooks/useInputLayer.js';
|
||||
import { useInvitations } from '../../hooks/useInvitations.js';
|
||||
import { colors, logoSmall, formatSatoshis } from '../../theme.js';
|
||||
import { copyToClipboard } from '../../utils/clipboard.js';
|
||||
@@ -421,10 +422,10 @@ export function InvitationScreen(): React.ReactElement {
|
||||
}, [handleAction]);
|
||||
|
||||
// ── Keyboard navigation ──────────────────────────────────────────────────
|
||||
// Disabled when the ID dialog or import flow is open.
|
||||
const isOverlayOpen = showIdDialog || importingId !== null;
|
||||
// Automatically blocked when any dialog/overlay is capturing input.
|
||||
const isCaptured = useIsInputCaptured();
|
||||
|
||||
useInput((input, key) => {
|
||||
useBlockableInput((input, key) => {
|
||||
if (key.tab) {
|
||||
setFocusedPanel(prev => prev === 'list' ? 'actions' : 'list');
|
||||
return;
|
||||
@@ -437,7 +438,7 @@ export function InvitationScreen(): React.ReactElement {
|
||||
if (input === 'i') {
|
||||
setShowIdDialog(true);
|
||||
}
|
||||
}, { isActive: !isOverlayOpen });
|
||||
});
|
||||
|
||||
// ── Render helpers ───────────────────────────────────────────────────────
|
||||
|
||||
@@ -639,7 +640,7 @@ export function InvitationScreen(): React.ReactElement {
|
||||
selectedIndex={selectedIndex}
|
||||
onSelect={setSelectedIndex}
|
||||
onActivate={handleListItemActivate}
|
||||
focus={focusedPanel === 'list' && !isOverlayOpen}
|
||||
focus={focusedPanel === 'list' && !isCaptured}
|
||||
maxVisible={6}
|
||||
groups={invitationListGroups}
|
||||
emptyMessage="No invitations yet"
|
||||
@@ -663,7 +664,7 @@ export function InvitationScreen(): React.ReactElement {
|
||||
selectedIndex={selectedActionIndex}
|
||||
onSelect={setSelectedActionIndex}
|
||||
onActivate={handleActionItemActivate}
|
||||
focus={focusedPanel === 'actions' && !isOverlayOpen}
|
||||
focus={focusedPanel === 'actions' && !isCaptured}
|
||||
emptyMessage="No actions"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user