-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
a11y improvements for template to-do list #1207
Conversation
Thank you! Can you explain the rationale for focusing the h1 after deleting a todo? I would have thought it was better to keep the focus in the same part of the document, so you can easily tab/shift-tab to the next/previous item |
I think we should probably be focusing the next item in the list (the item that follows the deleted item). |
Thanks for the feedback--I originally focused the h1 because it was simplest. But I agree that it makes sense to keep focus in the same part of the document. I updated the logic to focus the next edit input if it exists, or the previous edit input if it's the last todo in the list, or the "add a todo" field if there are no todos remaining. I used I also had to wait a |
packages/create-svelte/templates/default/src/routes/todos/index.svelte
Outdated
Show resolved
Hide resolved
This is adding a ton of complexity to something that is supposed to be an easy-to-follow demo. Isn't the current focusing behaviour okay? After deleting a todo, Could we just keep the |
That's fair -- I've removed the focus management behavior from the PR. It was definitely getting a little complex for a demo. |
Thank you! |
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
Changesets
pnpx changeset
and following the promptsThis PR improves the accessibility of the to-do list in the starter template.
Programmatically manage focus on delete. Since the focused element is removed from the DOM, we should explicitly focus an element since browsers can be inconsistent. I chose to focus the heading at the top of the list.EDIT: Removed this, it was adding too much complexity for not enough benefit.