Review main Merged

87856[BUGFIX] Make table sorting more usable

Benjamin Kott CR +2 V +2 Hard +585 −220 updated 02/05/25, 16:04

Commit message

This patch improves the usability for sorting
columns in table listings. It provides clear
actionable buttons that state the action that is
done when pressing the button. That are placed
in a dropdown attached to the table header.

Actions that have previously cluttered the view
are now directly attached to the item in the dropdown
that also contains the sorting buttons. This helps
the user to identify better the effect of these
buttons, while also they contain readable labels for
all usergroups.

We now also allow to edit columns directly from
the list overview page.

Review

  • Code review CR +2 Done
    • Benjamin Kott +2
    • Benjamin Franzke +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Kott +2
    • Benjamin Franzke +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 2

Files 14

Review log 6083

Show 4158 earlier messages
  1. Benjamin Kott uploaded patch set 1 01/22/25, 15:30

  2. core-ci voted on patch set 1 V -1 01/22/25, 15:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72866

  3. Benjamin Kott uploaded patch set 2 V -1 01/23/25, 08:16

  4. core-ci voted on patch set 2 V -1 01/23/25, 08:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72904

  5. Benjamin Kott uploaded patch set 3 V -1 01/23/25, 08:29

  6. core-ci voted on patch set 3 V -1 01/23/25, 08:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72906

  7. Benjamin Kott uploaded patch set 4 V -1 01/23/25, 09:09

  8. core-ci voted on patch set 4 V -1 01/23/25, 09:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72907

  9. Benjamin Kott uploaded patch set 5 V -1 01/23/25, 09:20

  10. core-ci voted on patch set 5 V +1 01/23/25, 09:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72910

  11. Benjamin Kott uploaded patch set 6 V +1 01/23/25, 12:10

  12. core-ci voted on patch set 6 V +1 01/23/25, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72923

  13. Benjamin Kott uploaded patch set 7 V +1 01/23/25, 12:57

  14. core-ci voted on patch set 7 V +1 01/23/25, 13:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72926

  15. Benjamin Kott uploaded patch set 8 V +1 01/23/25, 13:20

  16. core-ci voted on patch set 8 V +1 01/23/25, 13:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72927

  17. Benjamin Kott uploaded patch set 9 V +1 01/23/25, 13:31

  18. core-ci voted on patch set 9 V +1 01/23/25, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72928

  19. Andreas Kienast commented on patch set 9 CR -1 V +1 01/23/25, 14:03

    DatabaseRecordList.php:1505

    Can be shortened (and optionally made `static`): `fn ($item) => '<li>' . $item . '</li>'`

    DatabaseRecordList.php:1506

    Instead of counting all time time, I'd count once and store the result in a variable.

    DatabaseRecordList.php:1507

    Same here regarding shorting the code.

    DatabaseRecordList.php:2193

    Either call `trigger_error(..., E_USER_DEPRECATED)` in the method OR drop this as the class is `@internal`.

    locallang_core.xlf:157

    Do we need the "button" infix here? It's not a button, but a dropdown. It'd also make the label more generic.
  20. Benjamin Kott uploaded patch set 10 CR -1 V +1 01/23/25, 14:24

  21. Benjamin Kott commented on patch set 10 01/23/25, 14:26

    DatabaseRecordList.php:1505 Reply

    Done

    DatabaseRecordList.php:1506 Reply

    Done

    DatabaseRecordList.php:1507 Reply

    Done

    DatabaseRecordList.php:2193 Reply

    Done

    locallang_core.xlf:157 Reply

    would like to keep it generic - the context is of a button - i don´t think the dropdown matters here.
  22. core-ci voted on patch set 10 V -1 01/23/25, 14:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72933

  23. Benjamin Kott uploaded patch set 11 V -1 01/23/25, 14:41

  24. Andreas Kienast commented on patch set 10 01/23/25, 14:41

    locallang_core.xlf:157 Reply

    That's why I suggest to rename the label to `labels.sorting.asc` to have it the most generic way possible.
  25. core-ci voted on patch set 11 V +1 01/23/25, 14:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72934

  26. Ayke Halder commented on patch set 11 01/23/25, 15:22

    DatabaseRecordList.php:1340

    Here we already know that `$currentIdList` is an `array`. So I'd check for `!empty()` instead of counting the length. Same goes for all array counting where the result is just used to check if it is not empty. ---- And even checking for `empty` is kind of unnecessary - we could actually just put the array itself into the `if`-statement: But I don't recommend this as this is not really readable. ``` if ($this->table && $this->canEditTable($table) && $currentIdList && $this->isEditable($table)) { . ``` * empty array --> bool FALSE * array has entries --> bool TRUE ``` # php -r 'echo !empty([]) ? "TRUE" : "FALSE";' FALSE # php -r 'echo [] ? "TRUE" : "FALSE";' FALSE # php -r 'echo !empty([0 => "something"]) ? "TRUE" : "FALSE";' TRUE # php -r 'echo [0 => "something"] ? "TRUE" : "FALSE";' TRUE . ```

    DatabaseRecordList.php:1484

    Result of `count()` is only used like `bool`. So maybe instead of `int` use `bool` from `!empty(…)`.
  27. Benjamin Kott commented on patch set 11 01/23/25, 21:54

    DatabaseRecordList.php:1340 Reply

    empty is a weak check and disallowed with strict phpstan rules. see: https://github.com/phpstan/phpstan-strict-rules

    DatabaseRecordList.php:1484 Reply

    see note about empty() usage, we can cast it to a bool here - i have no hard feelings about bool
  28. Ayke Halder commented on patch set 11 01/23/25, 22:22

    DatabaseRecordList.php:1340 Reply

    Thanks for pointing this out. I found this article: https://localheinz.com/articles/2023/05/10/avoiding-empty-in-php/#content-array Let's go for: `$currentIdList !== []` instead of `count($currentIdList) > 0`

    DatabaseRecordList.php:1484 Reply

    Let's go for something like: ``` $dropdownExtraHasItems = $dropdownExtraItems !== []; $dropdownSortingHasItems = $dropdownSortingItems !== []; . ```
  29. Benjamin Kott uploaded patch set 12 V +1 01/24/25, 07:21

  30. Benjamin Kott commented on patch set 12 01/24/25, 07:22

    DatabaseRecordList.php:1340 Reply

    Done

    DatabaseRecordList.php:1484 Reply

    Done
  31. Benjamin Kott uploaded patch set 13 01/24/25, 07:24

  32. Benjamin Kott commented on patch set 13 01/24/25, 07:25

    locallang_core.xlf:157 Reply

    got it
  33. core-ci voted on patch set 12 V +1 01/24/25, 07:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72954

  34. core-ci voted on patch set 13 V +1 01/24/25, 07:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72955

  35. Ayke Halder commented on patch set 13 01/24/25, 09:53

    DatabaseRecordList.php:2303

    Checking `overlayEditLockPermissions($table)` without any `$row`-argument is only necessary for `$table !== 'pages'`. `$this->overlayEditLockPermissions($table)` always returns true for `$table === 'pages'` if no `$row`-argument is provided.
  36. Benjamin Kott commented on patch set 13 01/24/25, 10:07

    DatabaseRecordList.php:2303 Reply

    this code is only moved, would prefer to not change the logic here in this patch.
  37. Benjamin Kott uploaded patch set 14 V +1 01/24/25, 10:39

  38. Benjamin Kott updated the commit message in patch set 15 01/24/25, 10:41

  39. Ayke Halder commented on patch set 13 01/24/25, 10:45

    In general about the accessibility of sorting implemented in a dropwdown: Is this really accessible like this? I would assume that clicking the column-label directly changes the sorting. Some points to consider about the implementation: * Maybe add `aria-sort` to the active `th`-element * Add a 'sr-only' caption to the table which describes that the table is sortable by using the dropdown menus. * IMO sorting is already indicated by the sorting arrows - so the dropdown-arrow should only be visible if there are other options than sorting in the dropdown-menu (like "Edit field … of the listed records"). * Currently active sorting-entry in the dropdown has an active-indicator - also needs some marking like `<a role="button" aria-pressed="true" …>` * Pressing the active sorting-entry again should do something meaningful like "disable the sorting" - or the active entry should be 'disabled'. Also see: https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/sortable-table/ https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed Current code as of: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87856/13 ```html <th class="nowrap"> <div class="dropdown"> <button class="dropdown-toggle dropdown-toggle-link" type="button" data-bs-toggle="dropdown" aria-expanded="false" > Column header name <div class="text-primary"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-sort-amount-up" data-identifier="actions-sort-amount-up" aria-hidden="true" >…</span> </div> </button> <ul class="dropdown-menu"> <li> <a class="dropdown-item" href="/typo3/module/web/list?…&amp;sortField=…&amp;sortRev=0" title="Sort ascending" aria-label="Sort ascending" > <span class="dropdown-item-columns"> <span class="dropdown-item-column dropdown-item-column-icon text-primary"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-dot" data-identifier="actions-dot" aria-hidden="true" >…</span> </span> <span class="dropdown-item-column dropdown-item-column-title"> Sort ascending </span> </span> </a> </li> <li> <a class="dropdown-item" href="/typo3/module/web/list?…&amp;sortField=…&amp;sortRev=1" title="Sort descending" aria-label="Sort descending" > <span class="dropdown-item-columns"> <span class="dropdown-item-column dropdown-item-column-icon text-primary"> </span> <span class="dropdown-item-column dropdown-item-column-title"> Sort descending </span> </span> </a> </li> <li> <hr class="dropdown-divider" aria-hidden="true"> </li> <li> <button type="button" class="dropdown-item t3js-record-edit-multiple" title="Edit the 'Enabled' field of the listed records" aria-label="Edit the 'Enabled' field of the listed records" data-return-url="/typo3/module/web/list?…" data-columns-only="[&quot;hidden&quot;]" > <span class="dropdown-item-columns"> <span class="dropdown-item-column dropdown-item-column-icon"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-document-open" data-identifier="actions-document-open" aria-hidden="true" >…</span> </span> <span class="dropdown-item-column dropdown-item-column-title"> Edit the 'Enabled' field of the listed records </span> </span> </button> </li> </ul> </div> </th> ```
  40. core-ci voted on patch set 14 V +1 01/24/25, 10:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72966

  41. core-ci voted on patch set 15 V +1 01/24/25, 10:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72967

  42. Ayke Halder commented on patch set 15 01/24/25, 11:12

    DatabaseRecordList.php:2303 Reply

    Acknowledged
  43. Benni Mack voted on patch set 15 CR +1 V +1 01/24/25, 11:32

  44. Ayke Halder commented on patch set 15 V -1 01/24/25, 12:06

    Reply

    UX-issue: It's not directly visible if there are any other features than sorting in the dropdown. E.g. see column "Last modified" which has only the sorting options. Therefore I suggest this: * IMO sorting is already indicated by the sorting arrows - so the dropdown-arrow should only be visible if there are other options than sorting in the dropdown-menu (like "Edit field … of the listed records").
    Even if this change is not about accessibility, please take the mentioned UX-issue into account.
  45. Benjamin Kott uploaded patch set 16 CR +1 V +1 01/24/25, 13:36

  46. Ayke Halder commented on patch set 16 01/24/25, 13:38

    Reply

    Discussion on Slack: https://typo3.slack.com/archives/C027S88NY/p1737722075100139 Closing this as we are going for absolute identical dropdown-styling all around the TYPO3-backend.
  47. Benjamin Kott commented on patch set 16 01/24/25, 13:39

    Reply

    The active button in the dropdown can not have the aria-pressed attribute at it´s only relevant but buttons that change it state on multiple presses, this is not the case here - it´s not a toggle button.
  48. core-ci voted on patch set 16 V +1 01/24/25, 13:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72976

  49. Benjamin Kott commented on patch set 16 01/24/25, 13:43

    Reply

    Regarding the aria-sort, would love to add this in the future, but in the current way the record and filelist is implemented we have no knowledge about whats rendered inside the columns as we only pass strings and not information around.
  50. Benjamin Kott commented on patch set 16 01/24/25, 13:46

    Reply

    regarding pressing the active sorting-entry again should do something "meaningful", is something we should improve upon - but would like to iterate here on a later point as we have no way really to unset the javascript (tablesort) implementation here to restore the original behavior.
  51. Andreas Kienast voted on patch set 16 CR +1 V +1 01/24/25, 13:51

  52. Ayke Halder commented on patch set 16 01/24/25, 13:56

    Reply

    Regarding active item: It's all about to get any kind of aria-marking: `aria-current`/`aria-selected`/`aria-pressed`/`aria-checked` Thought about toggle like "sorting ascending: on/off" and "sorting descending: on/off" Next thing coming to my mind `<a role="radio" aria-checked="true">` https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role But maybe `role="listbox` + `<a role="option" aria-selected="true/false">` is even better. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected So these a11y issues are open for improvement in the future.
  53. Ayke Halder commented on patch set 16 01/24/25, 14:08

    May we go for "more usable" here?
    Same: "usability"
  54. Benjamin Kott updated the commit message in patch set 17 CR +1 V +1 01/27/25, 08:06

  55. Benjamin Kott commented on patch set 17 01/27/25, 08:07

    Reply

    i am fine adjusting this, even i think the initial wording is totally fine here.

    Reply

    i am fine adjusting this, even i think the initial wording is totally fine here.
  56. Andreas Kienast voted on patch set 17 CR +1 V +1 01/27/25, 08:09

  57. core-ci voted on patch set 17 V +1 01/27/25, 08:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73048

  58. Ayke Halder commented on patch set 17 01/27/25, 10:06

    Reply

    "Accessibility" (A11y) and "accessible" have a well defined meaning: https://www.w3.org/WAI/fundamentals/accessibility-intro/#what > Web accessibility means that websites, tools, and technologies are designed and developed so that people with disabilities can use them. https://developer.mozilla.org/en-US/docs/Web/Accessibility > Accessibility (often abbreviated to A11y — as in, "a", then 11 characters, and then "y") in web development means enabling as many people as possible to use websites, even when those people's abilities are limited in some way. ---- On the other hand wordings like "usability" and "user experience (UX)" can be used without any restrictions.
  1. Benjamin Kott commented on patch set 17 01/27/25, 10:58

    Reply

    The main reason for this change was to improve accessibility, it makes navigation less cluttered and the actions more understandable therefore easier to use. Especially when you are using the keyboard. I understand that this benefits both sides and we can call it UX now.
  2. Christian Kuhn commented on patch set 17 01/27/25, 13:42

    some word missing here.
  3. Benni Mack updated the commit message in patch set 18 CR +1 V +1 01/27/25, 17:08

  4. core-ci voted on patch set 18 V +1 01/27/25, 17:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73061

  5. Benjamin Kott commented on patch set 18 01/31/25, 07:25

    Reply

    Done
  6. Andreas Kienast voted on patch set 18 CR +1 V +1 01/31/25, 07:34

  7. Benni Mack voted on patch set 18 CR +1 V +1 01/31/25, 23:56

  8. Benjamin Kott voted on patch set 18 CR +2 V +2 02/03/25, 06:36

  9. Benjamin Kott voted on patch set 18 CR -1 V -1 02/03/25, 06:45

  10. Benjamin Kott uploaded patch set 19 CR +1 V +1 02/03/25, 07:00

  11. core-ci voted on patch set 19 V +1 02/03/25, 07:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73360

  12. Andreas Kienast voted on patch set 19 CR +1 V +1 02/04/25, 09:02

  13. Benjamin Kott uploaded patch set 20 CR +1 V +1 02/05/25, 14:57

  14. core-ci voted on patch set 20 V -1 02/05/25, 15:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73590

  15. Benjamin Kott rebased onto patch set 21 V -1 02/05/25, 15:11

  16. Benjamin Franzke voted on patch set 21 V +1 02/05/25, 15:11

  17. core-ci voted on patch set 21 V +1 02/05/25, 15:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73591

  18. Benjamin Kott uploaded patch set 22 V +1 02/05/25, 15:31

  19. core-ci voted on patch set 22 V +1 02/05/25, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73592

  20. Benjamin Kott uploaded patch set 23 V +1 02/05/25, 15:40

  21. Benjamin Franzke voted on patch set 23 CR +1 V +1 02/05/25, 15:40

  22. Andreas Kienast voted on patch set 23 CR +1 V +1 02/05/25, 15:42

  23. core-ci voted on patch set 23 V +1 02/05/25, 15:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73596

  24. Benjamin Kott voted on patch set 23 CR +2 V +2 02/05/25, 15:52

  25. Benjamin Kott merged patch set 24 02/05/25, 16:04