react-virtualized notification when List gets focus

ぃ、小莉子 提交于 2019-12-11 06:13:29

问题


When a user tabs into a List and the List gets focus I want to put a border around the List's parent. It would be great if I could call onFocus/onBlur on the List. Any advice?


回答1:


Currently there is no way to attach onBlur or onFocus events (or anything other than onScroll) to a Grid. (The same is true for List which just decorates a Grid).

You could add this behavior yourself using the ref though. Here is an example Plnkr: https://plnkr.co/edit/TVxnhf?p=preview

The key part is:

  _setListRef(listRef) {
    if (listRef) {
      listRef = findDOMNode(listRef);
      listRef.addEventListener('blur', onListBlur);
      listRef.addEventListener('focus', onListFocus);
    }
  }


来源:https://stackoverflow.com/questions/44188298/react-virtualized-notification-when-list-gets-focus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!