Right Click Menu using React JS

后端 未结 2 439
死守一世寂寞
死守一世寂寞 2020-12-25 12:50

I\'d like to know if there is a best practice/correct way to setup a right-click menu for a React component.

I currently have this...

// nw is nw.gui         


        
2条回答
  •  难免孤独
    2020-12-25 13:31

    There are few things to take care about with popup menus:

    1. it should be rendered away from its parent and siblings - preferably in an overlay which is the last child of document.body
    2. special logic should take care that it's always displayed on screen and never cropped by screen edges
    3. if there is a hierarchy involved, child popups should be aligned to items from previous popup (opener).

    I created a library which you can use to accomplish all of these:

    http://dkozar.github.io/react-data-menu/

提交回复
热议问题