web-components icon indicating copy to clipboard operation
web-components copied to clipboard

Allow Grid multi-sort with shift+click

Open OlliTietavainenVaadin opened this issue 1 year ago • 2 comments

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

OlliTietavainenVaadin avatar Oct 06 '22 10:10 OlliTietavainenVaadin

might be a good feature for the GridPro

SebastianKuehnau avatar Oct 06 '22 11:10 SebastianKuehnau

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:

  1. 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)
  2. Users unable to use keyboard and pointer device in parallel will be unable to use it
  3. 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.

rolfsmeds avatar Oct 14 '22 06:10 rolfsmeds

Closing as done via https://github.com/vaadin/web-components/pull/4882 and https://github.com/vaadin/flow-components/pull/4005

rolfsmeds avatar Nov 30 '22 07:11 rolfsmeds