palantir/blueprint

Editable Cell with enableFocusedCell stealing focus

Open

#4,796 opened on 2021年7月2日

GitHub で見る
 (0 comments) (1 reaction) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P2Package: tableType: bughelp wanted

説明

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

コントリビューターガイド