Open
Conversation
zoltan-dulac
reviewed
Feb 5, 2025
Collaborator
There was a problem hiding this comment.
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: noneis 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
Rankcolumn (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> |
Collaborator
There was a problem hiding this comment.
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> |
Collaborator
There was a problem hiding this comment.
I am not sure this is right. The numeric data is not being sorted correctly. Can you fix?
js/modules/sortable-tables.js
Outdated
| if (sortType === "number") { | ||
| compareFunc = createCompareFunc(this.functions['exampleCustomCompare'], index); | ||
| } else { | ||
| compareFunc = createCompareFunc((a, b) => a.localeCompare(b), index); |
Collaborator
There was a problem hiding this comment.
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
d948d7b to
cdb2803
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.