diff --git a/packages/table/src/cell/cell.tsx b/packages/table/src/cell/cell.tsx index d13c9af403..f4a41c410b 100644 --- a/packages/table/src/cell/cell.tsx +++ b/packages/table/src/cell/cell.tsx @@ -78,6 +78,11 @@ export interface ICellProps extends IIntentProps, IProps { */ onKeyUp?: React.KeyboardEventHandler; + /** + * Callback invoked when a character-key is pressed. + */ + onKeyPress?: React.KeyboardEventHandler; + /** * A ref handle to capture the outer div of this cell. Used internally. */ @@ -108,6 +113,7 @@ export class Cell extends React.Component { tabIndex, onKeyDown, onKeyUp, + onKeyPress, style, intent, interactive, @@ -163,7 +169,12 @@ export class Cell extends React.Component { const content =
{modifiedChildren}
; return ( -
+
{content} diff --git a/packages/table/src/cell/editableCell.tsx b/packages/table/src/cell/editableCell.tsx index 6582423a7c..a27ac16f63 100644 --- a/packages/table/src/cell/editableCell.tsx +++ b/packages/table/src/cell/editableCell.tsx @@ -120,7 +120,7 @@ export class EditableCell extends React.Component ); @@ -134,7 +134,13 @@ export class EditableCell extends React.Component + { + if (this.state.isEditing || !this.props.isFocused) { + return; + } + // setting dirty value to empty string because apparently the text field will pick up the key and write it in there + this.setState({ isEditing: true, dirtyValue: "", savedValue: this.state.savedValue }); + }; + private handleEdit = () => { this.setState({ isEditing: true, dirtyValue: this.state.savedValue }); };