ebayui-core icon indicating copy to clipboard operation
ebayui-core copied to clipboard

feat(ebay-table): support column sorting

Open bill-min opened this issue 1 year ago • 1 comments

Description

Context

References

Screenshots

https://github.com/user-attachments/assets/f57d8a50-bf51-4e0c-9103-5d2a9deb244c

bill-min avatar Oct 15 '24 19:10 bill-min

🦋 Changeset detected

Latest commit: c613ef65ca26520380ad8dc3cdb993db6bace7ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ebay/ebayui-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 15 '24 19:10 changeset-bot[bot]

Clicking sort doesn't appear to be re-rendering the table for me:

Screenshot 2024-10-28 at 4 33 55 PM Screenshot 2024-10-28 at 4 33 49 PM Screenshot 2024-10-28 at 4 33 44 PM

ianmcburnie avatar Oct 28 '24 23:10 ianmcburnie

Clicking sort doesn't appear to be re-rendering the table for me:

Screenshot 2024-10-28 at 4 33 55 PM Screenshot 2024-10-28 at 4 33 49 PM Screenshot 2024-10-28 at 4 33 44 PM

This is something we discussed with bill We only emit an event and let teams to do the sort on their end. We don't want to include a janky sorting logic that 99% of the time wont be used. We only swap the sort icon. I believe this is mentioned in the on-sort event docs.

agliga avatar Oct 29 '24 13:10 agliga

@ianmcburnie Also we don't have reference to input data, so theoretically we cannot sort rows. We can add explanatory code in examples but that would make example file pretty big.

bill-min avatar Oct 29 '24 14:10 bill-min

So this is more related to Skin (@ArtBlue), but I'm still not convinced we should be using aria-pressed on the sort buttons for ascending and descending state:

Toggle buttons require a full press-and-release cycle to change their value. Pressing and releasing it once changes the value to true. If it's pressed and released again, the value changes back to false.

We do not meet the criteria for this press and release cycle because we have more than two values. We could possibly use a value of mixed, but I'm not sure there's any real benefit in that.

Source: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed

Also, the APG pattern is not using aria-pressed: https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/sortable-table/

ianmcburnie avatar Oct 30 '24 02:10 ianmcburnie

One issue Im seeing on the sort is that when it is toggled to none, it should reset the list to the initial state. We might need to clone the list in that case and then set it to the initial clone when sorting is none.

agliga avatar Oct 30 '24 04:10 agliga

One issue Im seeing on the sort is that when it is toggled to none, it should reset the list to the initial state. We might need to clone the list in that case and then set it to the initial clone when sorting is none.

Fixed, good catch.

bill-min avatar Oct 30 '24 12:10 bill-min