Skip to content

Add Sortable Component (Based on sortable.js)#209

Open
russkyc wants to merge 7 commits intoblazorblueprintui:developfrom
russkyc-forked-repos:feat/add-sortable-component
Open

Add Sortable Component (Based on sortable.js)#209
russkyc wants to merge 7 commits intoblazorblueprintui:developfrom
russkyc-forked-repos:feat/add-sortable-component

Conversation

@russkyc
Copy link
Contributor

@russkyc russkyc commented Mar 5, 2026

Description

Adds a new BbSortable<TItem> component to BlazorBlueprint.Components, providing drag-and-drop sortable lists and grids powered by Sortable.js. Includes a new SortableLayout enum (List/Grid), JS interop module (wwwroot/js/sortable.js) with a bundled Sortable.js library, component styling, and a full demo page with multiple examples (basic list, drag handle, connected lists, grid layout, and Kanban-style board). Updates the demo components index and sidebar navigation, and updates the Components API surface snapshot baseline.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Testing Checklist

  • Blazor Server
  • Blazor WebAssembly
  • Blazor Hybrid (MAUI)
  • Keyboard navigation / accessibility
  • Dark mode

Related Issues

None

@russkyc russkyc changed the base branch from main to develop March 5, 2026 08:59
Copilot AI and others added 4 commits March 5, 2026 09:07
…layout, and comprehensive demo

- Extract BbSortable code to BbSortable.razor.cs (partial class)
- Add @namespace BlazorBlueprint.Components to BbSortable.razor
- Rename T→TItem and SortableItemTemplate→ItemTemplate
- Fix ForceFallback bug (param was defined but never passed to JS init())
- Add OnAdd EventCallback + OnAddJS [JSInvokable] for clean cross-list tracking
- Add WAI-ARIA: role=list, aria-label, sr-only live region announcements
- Add Layout (SortableLayout.List/Grid), Class, AriaLabel, AdditionalAttributes params
- Add SortableLayout enum (List, Grid)
- Update sortable.js: add onAdd handler, forceFallback now correctly wired from .NET
- Create SortableDemo.razor: basic list, handle, multiple lists, grid, kanban
- Create CodeExamples/Components/Sortable/{basic,handle,multiple-lists,grid,kanban}.txt
- Add Sortable to DemoSidebar.razor navigation (between Spinner and Split Button)
- Add Sortable card to Pages/Components/Index.razor
- Update API surface baseline to include BbSortable and SortableLayout

Co-authored-by: russkyc <32549126+russkyc@users.noreply.github.com>
Co-authored-by: russkyc <32549126+russkyc@users.noreply.github.com>
…-component-demo

feat(sortable): refactor BbSortable, add WAI-ARIA, OnAdd event, grid layout, and comprehensive demo
@russkyc russkyc marked this pull request as ready for review March 5, 2026 17:19
@russkyc
Copy link
Contributor Author

russkyc commented Mar 5, 2026

Hi @mathewtaylor , this is a basic implementation of the sortable component. This would cater to both sorting and drag and drop. Here are some previews:

compressO-basic-list.mp4
compressO-connected-lists.mp4
compressO-grid.mp4
compressO-kanban.mp4

Some quirks:

  • It seems that in server-side rendering mode, the dom updates twice when commiting the sort. First from sortable.js and then from blazor, which causes a split second flicker to the previous dom state.
  • if the sortable item tempalte is a component it needs to be wrapped in a div, something reported in other implementations of the sortable.js library in blazor.

I don't know if this is the best route because of the quirks, but it could be a starting point. I can't seem to get the quirks ironed out even with copilot.

@russkyc russkyc changed the title [In Progress] Add Sortable Component (DragDrop & Sort) Add Sortable Component (Based on sortable.js) Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants