Repository navigation
Conversation
Contributor
|
Since #583, components use the danger roles instead of the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
DataTable's built-in editors already handle draft input, parsing, and keyboard navigation, but screens must build their own feedback for failures in editing callbacks. A screen can reject a proposed value by leaving
dataunchanged, yet that does not provide a consistent, accessible way to explain the failure beside the affected cell.The goal here is declarative error presentation, not a new validation API. Existing callbacks should remain responsible for application rules and persistence, while DataTable supplies a standard error popover and lets consumers customize its content.
An initial prototype exposed an important UX inconsistency: Enter discarded the rejected draft and restored the adopted value while leaving the cell marked invalid. The displayed value no longer matched the error, and correcting or dismissing that error was unclear. This change treats the draft and its failure as one editing session so they cannot become detached.
Screen shot
An error in cell
Error detail
Design Decision
Callback-driven errors with a standard popover
By default, synchronous throws and returned Promise rejections from
onValueChangeandonValueCommitteduse the cell's error popover. The standard body shows a non-emptyError.message, otherwise a localized fallback; arbitrary error objects and stack traces are not rendered.Consumers only configure exceptions to the default:
error: falsepreserves eager edit completion and leaves callback failures to the consumer.error.renderreplaces the popover body, including support for interactive React content. DataTable owns the indicator, positioning, keyboard access, and a Revert edit action.There is no presentation discriminator because only popovers are supported. Inline presentation was left out because it introduces separate questions about replacing cell content, editor layout, and display while typing. There are also no new
validate, schema, or business-constraint options.Keep the failed draft until success or cancellation
Each cell has one internal session:
idle,editing,confirming, orfailed. A failed state always contains its target draft.onValueCommittedruns.onValueCommittedis the confirmation attempt. A normal return or fulfilled Promise completes the edit; a throw or rejection retains the original draft for correction or explicit retry.The public callback signatures remain
=> voidto preserve compatibility with existing handlers and successful return values. Runtime Promise settlement is observed for the editing lifecycle, not used as a row value. Adoption, persistence, request cancellation, and rollback remain consumer-owned; suppressing stale UI results does not undo callback side effects.Error inspection is part of the cell's focus group
Opening or interacting with the error popover must not accidentally confirm or discard a draft. The cell and its portaled inspector are treated as one logical focus group. Alt+ArrowDown opens error details without changing existing editor-only Tab navigation. Closing the inspector leaves the draft intact; cancelling the edit clears both its draft and error.
Summary