Skip to content

Commit

Permalink
initial draft
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvisser committed Nov 19, 2024
1 parent 070a72d commit 22e49f8
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions packages/nimble-components/src/table/specs/editable-table-ixd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Nimble Editable Table (IxD)

## Overview

Nimble table support for interactive cell editing.

### Background

- [ViD spec](https://www.figma.com/file/PO9mFOu5BCl8aJvFchEeuN/Nimble_Components?type=design&node-id=5308-156796&mode=dev)
- [Component Issue](https://github.com/ni/nimble/issues/1876)

## Usage

**When to use:**

Use an editable table when you need to allow users to modify individual cells directly within the table.
This is particularly useful for scenarios where inline editing is required, such as data entry, spreadsheet-like applications, or any situation where quick and efficient data manipulation is necessary.

**When not to use:**

- When data integrity is critical and the table should not be modified by users.
- When the table is used for displaying static or read-only data.
- When the table contains sensitive information that should not be editable.
- When the user interface requires a more complex data entry form.

## Anatomy

![Editable table anatomy](./spec-images/editable-cell-anatomy.png)

| Element | Description |
| --------------------- | ------------------------------------------------------------------------ |
| Static cell value | Non-editable display of cell value |
| Action button | Button to open cell context menu. Appears on row hover or keyboard focus |
| Editable cell control | Text or numeric control that supports entering or editing cell data |

## Behavior

### States

![Editable cell states](./spec-images/editable-cell-states.png)

#### Error State

![Editable cell error states](./spec-images/editable-cell-error-data.png)

### ARIA Considerations

- Maintain compatibility with existing keyboard navigation behavior
- Consider resolving [existing ARIA gaps](https://github.com/ni/nimble/issues/2285)

### Mouse Interactions

![Editable cell mouse navigation](./spec-images/editable-cell-mouse-navigation.png)

- Editable table cells show the same row hover state as non-editable cells on mouse hover.
- I.e. When hovering over a row, the action menu button appears. Depending on the table's selection mode, the row may be highlighted.
- Single clicking editable cell shows the cell focus state.
- Double clicking the editable cell transforms the cell into an input control in the focus state.
- Clicking away from a focused editable cell sets the value and transforms it into the Cell focus state.

### Non-Mouse Interactions

![Editable cell key navigation](./spec-images/editable-cell-key-navigation.png)

- When a cell has keyboard focus (Cell focus state), pressing `TAB` or `ENTER` transforms the cell into an input control in the focus state (Edit focus state).
- When a cell has Edit focus, pressing `TAB` moves the focus to the action button, or to the next available focus target.

![Editable cell enter key](./spec-images/editable-cell-enter-key.png)

- When a cell has Edit focus, pressing `ENTER` sets the value and transforms it into the Cell focus state.

![Editable cell escape key](./spec-images/editable-cell-escape-key.png)

- When a cell has Edit focus, pressing `ESCAPE` reverts any value change and transforms it into the Cell focus state.

#### Touch-Screen Devices

- The edit workflow should support touch screen devices.

## Open Issues

See content marked "**QUESTION**" or "**NOTE**".

## References

- [AG Grid](https://www.ag-grid.com/example/)
- [Patternfly](https://www.patternfly.org/components/table/react-deprecated/#editable-rows)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 22e49f8

Please sign in to comment.