web-components
web-components copied to clipboard
Allow Grid multi-sort with shift+click
Describe your motivation
In Vaadin 8, you could add multi-sort columns by holding the shift key and clicking the columns. There should be at least an option to do this.
Describe the solution you'd like
The default version can still remain as it is, but there could be an option to enable shift-clicking for multi-sort selection.
Describe alternatives you've considered
No response
Additional context
No response
might be a good feature for the GridPro
Drafting some behavior and API specs for this:
Behavior
- Shift-clicking an unsorted column's sorter adds it to the multi-sort
- Shift-clicking a sorted column's sorter toggles its sort direction
- Clicking a column sorter clears the multi-sort and sorts by that column instead
- Shift + Space does the corresponding thing via keyboard
In summary, with shift-multi-sort mode enabled, shift-sorting works exactly like normal multi-sort, except you need to hold down shift.
API
Java API proposal: introduce overload of setMultiSort with parameter for toggling between default behavior (plain click multisort) and shift-click multisort: Grid::setMultiSort(boolean multiSort, boolean withShiftClick).
TS API proposal: introduce a multiSortShiftClick parameter – if set to true, multi-sort works by shift-click, if enabled with the multSort property.
Accessibility
This feature is problematic from an accessibility POV in a number of ways:
- Screen readers will not be able to inform the user about shift-clicking (and I'm unsure if Shift+Space even works with screen readers)
- Users unable to use keyboard and pointer device in parallel will be unable to use it
- Discoverability is an issue for all users, as there is no built-in visual indication of shift-click behavior
Thus, a11y limitations should be mentioned in JavaDoc, JsDoc and the Grid documentation section covering multi-sort.
Closing as done via https://github.com/vaadin/web-components/pull/4882 and https://github.com/vaadin/flow-components/pull/4005