Fix keyboard-navigation issues
#3377
Merged
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.
Fixes #3319
Instead of making complex query selectors this approach just filters out elements that shouldn't be targetable.
I mainly tested this code with use cases described in the issue, so if there are any other edge case I didn't consider please let me know.
For this now any
.js-minimizable-comment-groupis ignored if if it is minimized.I tested this with in #3242 (files), now only the files are targeted.
For me the comments also where hidden (and not visible when targeted) without pressing
ifirst, so I handled both scenarios.Targetable
#pullrequestreview-{id}elements are now only targetable if they contain a message.PR reviews with a message also contain a targetable element with
#pullrequestreview-{id}-body-html.So now pressing
jon this issue comment skips the two messageless review comments and goes to the next review with a message below.I noticed some problems with the
.filter()approach because we might filtered out the current targeted element.So e.g. if a messageless review is targeted, pressing
jwill jump to the first targetable element.A better approach might be to target the next/previous targetable element instead.
Happy for any feedback on this, or if there are any other issues/use cases where this code doesn't work 😄