NULL Value Specs¶
Context¶
A NULL value indicates that a value does not exist in a database. It is important to clarify that NULL is not the same as blank or zero. Ideally, we want users to think of NULL values as placeholders for unknown or missing values applicable otherwise.
Prototype¶
Link¶
Videos¶
User Experience¶
Considerations for handling NULL Values¶
When presented in tables, NULL values should be visually distinct so that the user understands that they are not the same as other string types. The style should attempt to communicate the absence of a value, similar to how placeholders are used in text input fields.
As for the process of transforming values to and from NULL, it will be important to have a consistent way of doing this across different data types.
Scenarios¶
Scenario 1: User identifies a NULL Value¶
Scenario 1a: The user identifies a NULL value in a table¶
Steps for 1a¶
- The user opens a table that contains
NULLvalues. - The user identifies a cell that contains a
NULLvalue.- The cell contains the word
NULLin all uppercase letters - The cell has a different styling
- A lighter background-color
- A muted text color
- A different font style (italic)
- The cell contains the word
Scenario 1b: The user identifies a NULL value in a record preview¶
Steps for 1b¶
- The user edits a value in a column that links to records from another table.
- The user sees the list of records displayed in the record selection dropdown.
- The user identifies a record that contains a
NULLvalue.- The field contains the word
NULLin all uppercase letters - The text has a muted text color
- The text has a different font style (italic)
- The field contains the word
Scenario 1c: The user identifies a NULL value in a boolean type column in checkbox display mode¶
Steps for 1c¶
- The user opens a table that contains
NULLvalues. - The user identifies a cell that contains an indeterminate state checkbox.
- The user hovers over the indeterminate checkbox, and a tooltip with the legend
NULLis displayed.
Scenario 2: User edits a NULL Value¶
Scenario 2a: Replacing NULL with a new value¶
Steps for 2a¶
- The user edits a
NULLvalue in a column. - The user enters
edit mode. - The user enters a new value and leaves
edit modeby pressing theenterkey or clicking outside the active cell. - The new value replaces the
NULLvalue.
Scenario 2b: Replacing NULL with an empty string¶
Steps for 2b¶
- The user edits a
NULLvalue in a column. - The user enters
edit mode. - A text input box is displayed in
edit modewith a placeholder set toNULL. - The new typed-in value replaces the placeholder text.
- The user clears the new value by pressing the
backspacekey until the value is completely cleared. - The user leaves
edit mode. - An empty string replaces the
NULLvalue. The cell appears blank.
Scenario 2c: The data type is boolean with checkbox display mode enabled¶
Steps for 2c¶
- The user edits a
NULLvalue in a column set to boolean type with the checkbox display mode enabled.- The field contains a checkbox in an indeterminate state, meaning the value is
NULL.
- The field contains a checkbox in an indeterminate state, meaning the value is
- The user clicks on the checkbox, going from indeterminate
NULLto checkedTRUE. - The user can click on the checkbox again to mark it as
FALSE. - To return the value to
NULL, the user can select the cell and press thedeletekey or use the contextual menu and select theSet as NULLoption.
Scenario 2d: The data type is number¶
Steps for 2d¶
- The user edits a
NULLvalue in a column set tonumbertype. - The user double-clicks the cell to enter `edit mode.
- The user leaves
edit modewithout making any changes. - The
NULLvalue remains unchanged.
Scenario 3: User sets a value to NULL¶
Scenario 3a: The column accepts NULL values¶
Steps for 3a¶
- The user selects a cell in a column that contains a value.
- The user clears the content of the selected cell.
- By pressing the
Shift+BackspaceorShift+Deletekeys. - By opening the contextual menu and selecting the
Set as NULLoption.
- By pressing the
- The selected cell now has a
NULLvalue.
Scenario 3b: The column does not accept NULL values¶
Steps for 3b¶
- The user selects a cell in a column that contains a value.
- The user attempts to clear the content of the selected cell.
- By pressing the
Shift+BackspaceorShift+Deletekeys.- The system prevents the insertion of a
NULLvalue. - An error message indicates that a NOT
NULLconstraint is applied to the column, and the system cannot insertNULLvalues.
- The system prevents the insertion of a
- By opening the contextual menu and selecting the
Set as NULLoption.- The ‘Set as
NULL’ option is disabled, and the user cannot select it.
- The ‘Set as
- By pressing the
Interactions¶
Select vs. Edit Mode Behaviors¶
In Select Mode, the cell is highlighted and set as the target for actions applying to the cell or elements associated with it, such as its row or column. Select Mode is toggled by clicking on a cell or by navigating to with the direction keys while Select Mode is active.
In Edit Mode, a cell provides additional functionality and interactions to users. Edit Mode is toggled by double-clicking on a cell or by typing a text character or pressing backspace while in Select Mode. However, certain data types could have different interactions. Once specific behaviors and components for each data type are introduced, we must further define these interactions to ensure compatibility.
We will create an additional issue to refine these interactions.
Text or Numeric Types¶
For the implementation of this spec, we should consider the following interactions for the editing of text and numeric types as summarized in the following table:
| current mode | DOM key |
result |
|---|---|---|
| select | any text character | switch to edit mode, place cursor at end, append a character to end of cell contents |
| select | Backspace |
switch to edit mode, place cursor at end, delete the last character |
| select | Delete |
nothing |
| select | Shift+Backspace |
set cell value to NULL |
| select | Shift+Delete |
set cell value to NULL |
| edit | Backspace |
delete a character to the left of cursor |
| edit | Delete |
delete a character to the right of cursor |
Boolean Type¶
In the case of boolean types, consider the following:
- Consider that the
checkboxis smaller than the cell, so clicking outside thecheckboxwould select the cell, and pressingdeletewould make the cellNULL. - Clicking inside the
checkboxwould toggle the value of the checkbox, similar to spreadsheets.
With Dropdown Enabled¶
Some column configurations will display a dropdown when editing the contents of a cell. For example, a column with a single-column foreign key constraint will show a record selector dropdown when in edit mode.
In the case of cells with dropdown enabled, consider the following:
- If no record is selected, the cell content should be
NULL. - To set the cell’s content as
NULL, the user can press thedeletekey while the cell is inselect mode. - To set the cell’s content as
NULL, the user can deselect a selected record from the record selector by clicking on a selected item and then closing the dropdown.