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

Sortable Paginated Table #250

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

KyryloPylypenko416
Copy link

No description provided.

Copy link
Collaborator

@zoltan-dulac zoltan-dulac left a comment

Choose a reason for hiding this comment

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

This is great work so far! :-)

There are a few other things I'd like to change to improve the user experience:

  • I want to maximize the hit area of the sort buttons. They should take up the whole area of the table column header to maximize the hit area. This is an accessibility feature for those who have tremors in their hands or other types of motor-coordination disabilities.
  • I have noticed that when using Voiceover/Safari to read the content of the table, I can still read the hidden rows. We should put a aria-hidden="true" on the rows we are hiding. For some reason, display: none is not preventing this (it should, but it doesn't). Please put a note in the code walkthrough why we are doing this.
  • I think the data needs a bit of refinement. Let's remove the Rank column (it's kind of useless). Let's mark up the countries as <th scope="row"> (they should be the left most cell). I don't want to change the style of them. The reason I want to do this is that it makes the data easier to understand to screen reader users (If they traverse the rows of the table, they understand automatically which row they are in).

data-sort-type="number">
<button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">Rank</button></th>
<th scope="col" data-sort-type="default"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">Name</button></th>
<th scope="col" data-sort-type="number"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">GDP (IMF '19)</button></th>
Copy link
Collaborator

@zoltan-dulac zoltan-dulac Feb 4, 2025

Choose a reason for hiding this comment

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

Let's rename this heading "GDP (IMF 2019)" to "GDP (Source: IMF 2019)". Same with the next heading: "GDP (Source: UN 2016)"

<th scope="col" data-sort-type="default"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">Name</button></th>
<th scope="col" data-sort-type="number"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">GDP (IMF '19)</button></th>
<th scope="col" data-sort-type="number"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">GDP (UN '16)</button></th>
<th scope="col" data-sort-type="default"> <button class="sortableColumnLabel" aria-describedby="user-info-table__sort-instructions">GDP Per Capita</button></th>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure this is right. The numeric data is not being sorted correctly. Can you fix?

if (sortType === "number") {
compareFunc = createCompareFunc(this.functions['exampleCustomCompare'], index);
} else {
compareFunc = createCompareFunc((a, b) => a.localeCompare(b), index);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we can change this from an anonymous function to a declared one, it would help performance:

https://stackoverflow.com/questions/80802/does-use-of-anonymous-functions-affect-performance

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