-
Notifications
You must be signed in to change notification settings - Fork 89
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
fix(table): improve sortable table accessibility #1280
Conversation
✅ Deploy Preview for stacks ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Just noticed this new PR for sortable tables - copying over my PR comments from #1144 so we don't miss some doc + styling fixes:
|
@StackExchange/stacks I'll defer to you all on whether or not this PR is in a good spot to review/test/merge. I'm comfortable with the tests I've written so far and think they cover a good chunk of the component's functionality. I need to step away from this PR to work on a few other things on my plate so I don't have time to write tests for the actual sorting logic right now. Where I left off:
Notes:
I've removed myself from the reviewers list since I wrote the majority of this code and don't feel comfortable reviewing it myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @allejo to make progress on this PR.
I have reviewed the source code and left a couple of comments that needs to be addressed by our team before being able to merge.
I haven't spent much time reviewing the tests. At a glance they look quite complex, but so it's the algorithm. Thanks for starting the effort though.
I would like to close up this PR soon, let me catchup with @dancormier and see how we can address the remaining items.
lib/components/table/table.ts
Outdated
* | ||
* @param headerEl | ||
*/ | ||
private ensureHeadersAreClickable = (headerEl: HTMLTableCellElement) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel strongly about NOT introducing a permanent markup transformer in Stacks to support legacy usage.
If we can automate the change at runtime we can do this also with a codemod that run once in Core before the library get upgraded.
We could look into codemods to automate everything but I suspect it will go faster to semi-automatically adjust (e.g. replace with regex in editor) the 20 occurrences in Core.
If we are concerned about breaking changes and semantic versioning we can make sure to support both elements (button and th) as valid targets until we are ready to ship v2.0 (where we can finally deprecate th).
If we decide to do that we should create some sort of a roadmap for Stacks 2.0.0 where we keep track of todos for the major release and also come up with a schedule (e.g. every 6 months we release a major).
Given that Stacks is primarily used by Core (we are not React or Bootstrap) I don't feel strongly about following semantic versioning by the book honestly (and for example communicate this small breaking change in a minor release v1.10.0
). Alternatively we could release v2.0.0
and accept that the major numbers will change relatively often (in my previous team when I left we were at 12.x.x
because we did not wait for breaking changes to pile up before cutting a release - as soon as they were ready we released and bump that major number). @dancormier any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to recall my thoughts from when we discussed this a couple weeks ago 😂 Feels like forever ago. Anyways…
I feel strongly about NOT introducing a permanent markup transformer in Stacks to support legacy usage.
If we can automate the change at runtime we can do this also with a codemod that run once in Core before the library get upgraded.
We could look into codemods to automate everything but I suspect it will go faster to semi-automatically adjust (e.g. replace with regex in editor) the 20 occurrences in Core.
I agree. I think the markup transformer is a little too much magic for Stacks. I think we could do the find+replace without too much complication. Only big issue I could see is if any tables are partially rendered with JS, but I figure we could always open a PR and find out.
I don't feel strongly about following semantic versioning by the book honestly
As for the semver discussion, I remember starting from a place of "I want to follow semver strictly" to "strict semver can cause complication for a library like ours". I doubt we'd benefit from waiting for several breaking changes as the overhead for our small team would be a lot, so we'd instead be doing major releases for any minor breaking change. So, I'm good to ship the occasional breaking change in minor versions as long as we communicate it and provide support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dancormier Thanks for bringing this PR to an end. I have left few final minor comments to address. After that feel free to merge.
Great work (also to you @allejo for initiating this in the first place) 🎉
This PR is built on top of #1144. It includes a merge of develop with conflict fixes the addition of a test (currently failing, but it's a start), the porting of styles to the refactored
tables.less
. Once the test is in a good place, we should be able to merge this work.@allejo I couldn't commit directly to your branch, so I made this one. Feel free to cherry pick from here or lift anything that's useful into your branch.