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
- Enter a value into any cell (do not do anything to confirm the value ie press enter)
- Click the red div (or anywhere outside the table...thus confirming the cell)
- press any key
- 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