palantir/blueprint

Editable Cell with enableFocusedCell stealing focus

开放

#4,796 创建于 2021年7月2日

 (0 条评论) (1 个反应) (0 位负责人)TypeScript (2,167 个派生)batch import
P2Package: tableType: bughelp wanted

仓库指标

星标
 (20,263 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Environment

Package version(s): @blueprintjs/table 3.7.1 Operating System: MacOS Catalina 10.15.7 Browser name and version: Chrome Version 91.0.4472.114

Code Sandbox

https://codesandbox.io/s/enablefocusedcell-bug-0m19u

Steps to reproduce

  1. Enter a value into any cell (do not do anything to confirm the value ie press enter)
  2. Click the red div (or anywhere outside the table...thus confirming the cell)
  3. press any key
  4. See the cell listens for the keypress

Actual behavior

Although there has been an interaction outside of the table, the cell is still the active element (see console) and steals the next keypress.

Expected behavior

I would expect once there has been a user interaction outside the table, the cell should not listen for keypresses.

Possible solution

I believe the focus is being forced by this function which runs on every render https://github.com/palantir/blueprint/blob/5c05ce6bb12a9810b9ff35310a1554a65af6b65d/packages/table/src/cell/editableCell.tsx#L214-L219

贡献者指南