-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
WIP: refactor: useRovingTabindex
to utilize IDs
#4292
Draft
WofWca
wants to merge
1
commit into
main
Choose a base branch
from
wofwca/roving-tabindex-refactor-with-ids
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
WofWca
force-pushed
the
wofwca/roving-tabindex-refactor-with-ids
branch
from
October 30, 2024 10:52
997add8
to
cb61499
Compare
WofWca
added a commit
that referenced
this pull request
Oct 30, 2024
Closes #2141 Basically what this commit comes down to: 1. Apply `useRovingTabindex` for message items 2. Set `tabindex="-1"` on all the interactive items inside every message that is currently not the active one, so that they do no have tab stops. TODO: - [ ] Address the TODOs in the code - [ ] Manage what's gonna be the initially active message, because initially they're all active, so tabbing to the messages list from the top selects the first rendered one as the active one. #4292 could help with this. This is also not great for performance: changing `tabindex` on a bunch of messages makes them all re-render. And otherwise, we probably want to update which one is the active one as new messages arrive.
WofWca
added a commit
that referenced
this pull request
Oct 30, 2024
Closes #2141 Basically what this commit comes down to: 1. Apply `useRovingTabindex` for message items 2. Set `tabindex="-1"` on all the interactive items inside every message that is currently not the active one, so that they do no have tab stops. TODO: - [ ] Address the TODOs in the code - [ ] Manage what's gonna be the initially active message, because initially they're all active, so tabbing to the messages list from the top selects the first rendered one as the active one. #4292 could help with this. This is also not great for performance: changing `tabindex` on a bunch of messages makes them all re-render. And otherwise, we probably want to update which one is the active one as new messages arrive. - [ ] The interactive items with `onClick` must be actual semantic `<button>`s. See #4210 for reference.
8 tasks
WofWca
added a commit
that referenced
this pull request
Oct 30, 2024
Closes #2141 Basically what this commit comes down to: 1. Apply `useRovingTabindex` for message items 2. Set `tabindex="-1"` on all the interactive items inside every message that is currently not the active one, so that they do no have tab stops. TODO: - [ ] Address the TODOs in the code - [ ] Manage what's gonna be the initially active message, because initially they're all active, so tabbing to the messages list from the top selects the first rendered one as the active one. #4292 could help with this. This is also not great for performance: changing `tabindex` on a bunch of messages makes them all re-render. And otherwise, we probably want to update which one is the active one as new messages arrive. - [ ] The interactive items with `onClick` must be actual semantic `<button>`s. See #4210 for reference.
WofWca
force-pushed
the
wofwca/roving-tabindex-refactor-with-ids
branch
from
November 22, 2024 11:17
cb61499
to
191b472
Compare
WofWca
commented
Dec 1, 2024
const tabIndex: 0 | -1 = | ||
// If the active element has not been chosen yet, | ||
// let' keep the default behavior (tabindex="0") | ||
context.activeElement == null || | ||
context.activeElement === elementRef.current | ||
context.activeElementId == null || context.activeElementId === elementId |
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.
=== null
WofWca
force-pushed
the
wofwca/roving-tabindex-refactor-with-ids
branch
from
December 1, 2024 14:18
191b472
to
f9c8af2
Compare
This should allow us to more easily `setActiveElement` by its ID, without having a reference to `HTMLElement`, e.g. we can more easily set the initial chat list item. This issue was mentioned in #4224: > The initially "active" element is just the first chat item, > and not the currently selected chat.
WofWca
force-pushed
the
wofwca/roving-tabindex-refactor-with-ids
branch
from
December 1, 2024 15:18
f9c8af2
to
854003d
Compare
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.
This should allow us to more easily
setActiveElement
by itsID, without having a reference to
HTMLElement
,e.g. we can more easily set the initial chat list item.
This issue was mentioned in #4224:
TODO:
useRovingTabindex
.ref
touseRovingTabindex
. I mean, it's too "raw" and not React-like.But perhaps the entire approach is this way, so maybe this is fine.