nomcopter / react-mosaic

A React tiling window manager

Home Page:https://nomcopter.github.io/react-mosaic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Attaching keyboard events for a mosaic window

fmg-lydonchandra opened this issue · comments

Hi, is there a nice way to capture keyboard events for a mosaic tile ?

One way is in renderTile, <div tabIndex={0} onKeyXxx={onKeyXxxHandler}> can wrap <MosaicWindow>
and we can propagate the keyboard events manually.
Must have tabIndex attribute to make <div> focusable

<div 
  role="presentation" 
  tabIndex={0} 
  onKeyDown={onKeyDownHandler} 
  onKeyUp={onKeyUpHandler}>

    <MosaicWindow<string>... />   
</div>

Your methodology seems fine - are there problems in practice?

It's working OK in practice, checking if there is a better way. Thanks for your quick response Kevin.