Selection events and cancellable changes
Emits a before-change event that can veto or modify a pending selection change, and an after-change event with a diff. The source (click, keyboard, api, selectAll, reload) is included. This lets applications enforce limits, such as a maximum of 5 selected rows, and track analytics locally.
Planned. This page shows the specification from issue #189. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A product grid with a max-selection knob set to 4 and an event log panel.
Expected behavior
Selecting beyond the limit is blocked, or trimmed to the limit, and the log shows the before and after events with their source and diff.
Planned API surface
onBeforeSelectionChange(event)event.preventDefault()event.nextKeysonSelectionChange({added, removed, selectedKeys, source})Acceptance criteria
- onBeforeSelectionChange fires before any visual update. (pending)
- Calling preventDefault leaves the selection unchanged. (pending)
- Replacing nextKeys applies the modified set. (pending)
- onSelectionChange includes the added and removed arrays and the source. (pending)
- No event fires when a requested change results in an identical selection. (pending)