Still have problem with canvas preventing key events from firing

This commit is contained in:
IRBorisov 2023-11-07 18:59:00 +03:00
parent 5be2fc0200
commit 3f4f9b03dc
6 changed files with 15 additions and 15 deletions

View File

@ -161,7 +161,7 @@ function EditorConstituenta({
} }
return ( return (
<div className='flex max-w-[1500px] gap-2' tabIndex={0} onKeyDown={handleInput}> <div className='flex max-w-[1500px] gap-2' tabIndex={-1} onKeyDown={handleInput}>
<form onSubmit={handleSubmit} className='min-w-[50rem] max-w-[50rem] px-4 py-1'> <form onSubmit={handleSubmit} className='min-w-[50rem] max-w-[50rem] px-4 py-1'>
<div className='relative w-full'> <div className='relative w-full'>
<div className='absolute top-0 right-0 flex items-start justify-between w-full'> <div className='absolute top-0 right-0 flex items-start justify-between w-full'>

View File

@ -293,7 +293,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst, onTemplates }: Edit
<div <div
className='w-full outline-none' className='w-full outline-none'
style={{minHeight: mainHeight}} style={{minHeight: mainHeight}}
tabIndex={0} tabIndex={-1}
onKeyDown={handleTableKey} onKeyDown={handleTableKey}
> >
<div className='sticky top-0 flex justify-start w-full gap-1 px-2 py-1 border-b items-center h-[2.2rem] select-none clr-app'> <div className='sticky top-0 flex justify-start w-full gap-1 px-2 py-1 border-b items-center h-[2.2rem] select-none clr-app'>

View File

@ -94,7 +94,7 @@ function EditorRSForm({ onDestroy, onClaim, onShare, isModified, setIsModified,
} }
return ( return (
<div tabIndex={0} onKeyDown={handleInput}> <div tabIndex={-1} onKeyDown={handleInput}>
<div className='relative flex items-start justify-center w-full'> <div className='relative flex items-start justify-center w-full'>
<div className='absolute flex mt-1'> <div className='absolute flex mt-1'>
<MiniButton <MiniButton

View File

@ -245,7 +245,6 @@ function EditorTermGraph({ onOpenEdit, onCreateCst, onDeleteCst }: EditorTermGra
if (event.key === 'Delete' && allSelected.length > 0) { if (event.key === 'Delete' && allSelected.length > 0) {
event.preventDefault(); event.preventDefault();
handleDeleteCst(); handleDeleteCst();
return;
} }
} }
@ -446,10 +445,11 @@ function EditorTermGraph({ onOpenEdit, onCreateCst, onDeleteCst }: EditorTermGra
{dismissed.map(cstID => { {dismissed.map(cstID => {
const cst = schema!.items.find(cst => cst.id === cstID)!; const cst = schema!.items.find(cst => cst.id === cstID)!;
const adjustedColoring = coloringScheme === 'none' ? 'status': coloringScheme; const adjustedColoring = coloringScheme === 'none' ? 'status': coloringScheme;
return (<> const id = `${prefixes.cst_hidden_list}${cst.alias}`
return (<div key={`wrap-${id}`}>
<div <div
key={`${cst.alias}`} key={id}
id={`${prefixes.cst_list}${cst.alias}`} id={id}
className='w-fit min-w-[3rem] rounded-md text-center cursor-pointer select-none' className='w-fit min-w-[3rem] rounded-md text-center cursor-pointer select-none'
style={{ style={{
backgroundColor: getCstNodeColor(cst, adjustedColoring, colors), backgroundColor: getCstNodeColor(cst, adjustedColoring, colors),
@ -462,16 +462,16 @@ function EditorTermGraph({ onOpenEdit, onCreateCst, onDeleteCst }: EditorTermGra
</div> </div>
<ConstituentaTooltip <ConstituentaTooltip
data={cst} data={cst}
anchor={`#${prefixes.cst_list}${cst.alias}`} anchor={`#${id}`}
/> />
</>); </div>);
})} })}
</div> </div>
</div>} </div>}
</div> </div>
</div> </div>
<div className='w-full h-full overflow-auto outline-none' tabIndex={0} onKeyDown={handleKeyDown}> <div className='w-full h-full overflow-auto outline-none' tabIndex={-1} onKeyDown={handleKeyDown}>
<div <div
className='relative' className='relative'
style={{width: canvasWidth, height: canvasHeight}} style={{width: canvasWidth, height: canvasHeight}}

View File

@ -384,7 +384,6 @@ function RSTabs() {
selectedIndex={activeTab} selectedIndex={activeTab}
onSelect={onSelectTab} onSelect={onSelectTab}
defaultFocus defaultFocus
forceRenderTabPanel
selectedTabClassName='clr-selected' selectedTabClassName='clr-selected'
className='flex flex-col items-center w-full' className='flex flex-col items-center w-full'
> >
@ -420,7 +419,7 @@ function RSTabs() {
</TabList> </TabList>
<div className='overflow-y-auto' style={{ maxHeight: panelHeight}}> <div className='overflow-y-auto' style={{ maxHeight: panelHeight}}>
<TabPanel style={{ display: activeTab === RSTabID.CARD ? '': 'none' }}> <TabPanel forceRender style={{ display: activeTab === RSTabID.CARD ? '': 'none' }}>
<EditorRSForm <EditorRSForm
isModified={isModified} isModified={isModified}
setIsModified={setIsModified} setIsModified={setIsModified}
@ -431,7 +430,7 @@ function RSTabs() {
/> />
</TabPanel> </TabPanel>
<TabPanel style={{ display: activeTab === RSTabID.CST_LIST ? '': 'none' }}> <TabPanel forceRender style={{ display: activeTab === RSTabID.CST_LIST ? '': 'none' }}>
<EditorItems <EditorItems
onOpenEdit={onOpenCst} onOpenEdit={onOpenCst}
onCreateCst={promptCreateCst} onCreateCst={promptCreateCst}
@ -440,7 +439,7 @@ function RSTabs() {
/> />
</TabPanel> </TabPanel>
<TabPanel style={{ display: activeTab === RSTabID.CST_EDIT ? '': 'none' }}> <TabPanel forceRender style={{ display: activeTab === RSTabID.CST_EDIT ? '': 'none' }}>
<EditorConstituenta <EditorConstituenta
isModified={isModified} isModified={isModified}
setIsModified={setIsModified} setIsModified={setIsModified}

View File

@ -34,6 +34,7 @@ export const globalIDs = {
export const prefixes = { export const prefixes = {
cst_list: 'cst-list-', cst_list: 'cst-list-',
cst_hidden_list: 'cst-hidden-list-',
cst_modal_list: 'cst-modal-list-', cst_modal_list: 'cst-modal-list-',
cst_template_ist: 'cst-template-list-', cst_template_ist: 'cst-template-list-',
cst_wordform_list: 'cst-wordform-list-', cst_wordform_list: 'cst-wordform-list-',