Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon indicating that there is no active sorting #14972

Closed
wants to merge 2 commits into from

Conversation

megawubs
Copy link
Contributor

@megawubs megawubs commented Dec 2, 2024

Description

Add visible indication that the table is not being sorted on initial state. This fixes #9627

Visual changes

Before (initial not sorted state)
image

After (initial not sorted state)
image

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date. -> Does this need a documentation update?

@danharrin
Copy link
Member

Hi, thanks for the PR! However, I personally am not a fan of how this looks (I find the two arrows too distracting and not consistent with the single arrows on active sorts), so I am going to close this. I also have not had many complaints about this UI before.

@danharrin danharrin closed this Dec 2, 2024
@megawubs
Copy link
Contributor Author

megawubs commented Dec 3, 2024

Hi @danharrin

I received feedback from our tester that this behavior is confusing for our end users. Combined with the linked discussion, that makes two instances of "complaints" about this issue. Looking at more examples of data tables, most of them have a (better) "not sorted" state indicator.

Here are some examples:

The last example is more similar to the Filament sorting table, but its "no active sort" indication is much clearer due to the color change. In contrast, the color change in the Filament table for active/inactive sort states is too subtle to serve as a clear indicator. Currently, it looks as though all columns are sorted in descending order by default. Only upon clicking and closely observing the column header color does the minimal visual change become apparent.

How about removing the icon entirely in the "not sorted" state and displaying the chevron-down icon when hovering over the table header to indicate that sorting is possible? When sorting is active, the corresponding icon (e.g., chevron-up or chevron-down) would appear. This approach would maintain the current icon style while providing a clear indication of whether sorting is active, inactive, or possible.

@@ -53,7 +53,13 @@ class="fi-ta-header-cell-label text-sm font-semibold text-gray-950 dark:text-whi
@if ($sortable)
<x-filament::icon
:alias="$activelySorted && $sortDirection === 'asc' ? 'tables::header-cell.sort-asc-button' : 'tables::header-cell.sort-desc-button'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to remove the icon, as then I do not think it would be clear which columns are sortable.

One idea you could PR is a new alias here: tables::header-cell.sort-button, and then you can register your own icon for the "not sorted" state: https://filamentphp.com/docs/3.x/support/icons#replacing-the-default-icons

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the best of both worlds! I didn't know of this feature. Awesome! I'll implement this in the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants