Skip to content

Conversation

@dertieran
Copy link
Contributor

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.

Hidden conversations in Files tabs are "focused"

For this now any .js-minimizable-comment-group is 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 i first, so I handled both scenarios.

PR reviews are skipped

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 j on 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 j will 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 😄

@fregante
Copy link
Member

It looks like event are also being targeted: #3242 (comment)

I'll suggest a selector for that

@fregante fregante marked this pull request as draft July 21, 2020 23:19
@fregante fregante added the bug label Jul 22, 2020
@dertieran dertieran force-pushed the fix-keyboard-navigation-issues branch from 60c49b4 to 3d8c7dc Compare July 23, 2020 06:51
@dertieran
Copy link
Contributor Author

dertieran commented Jul 23, 2020

I think I broke the test by force pushing mb 😅
Edit: Fixed it by pushing another commit.

@dertieran dertieran marked this pull request as ready for review July 27, 2020 15:04
@fregante fregante changed the title Fix keyboard navigation issues Fix keyboard-navigation issues Jul 30, 2020
@fregante fregante merged commit 7def592 into refined-github:master Jul 30, 2020
@fregante
Copy link
Member

Thank you! It appears to have fixed both issues

@dertieran dertieran deleted the fix-keyboard-navigation-issues branch July 30, 2020 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

keyboard-navigation issues

3 participants