Skip to content
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

Add alt-S to navigate between search regions #2189

Merged
merged 60 commits into from
Aug 9, 2024

Conversation

RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Mar 6, 2024

@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-vikpi6 March 6, 2024 16:15 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-vikpi6 March 6, 2024 17:26 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-vikpi6 March 7, 2024 19:23 Inactive
@RoyEJohnson RoyEJohnson changed the title Make search results a nav, labelled by its title Add alt-S to navigate between search regions Mar 7, 2024
@RoyEJohnson RoyEJohnson force-pushed the search-navigation-issues branch from bea6381 to 21fa234 Compare March 27, 2024 18:47
@RoyEJohnson RoyEJohnson force-pushed the search-navigation-issues branch 5 times, most recently from 46e1eb7 to 55a52bf Compare May 22, 2024 19:21
@RoyEJohnson RoyEJohnson marked this pull request as ready for review May 22, 2024 19:24
@RoyEJohnson RoyEJohnson requested a review from a team as a code owner May 22, 2024 19:24
@RoyEJohnson RoyEJohnson requested a review from Dantemss May 22, 2024 19:24

scrollTo(target);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this scrollTo() just gone now? I noticed it was gone from the tests too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. focus will scroll an element into view unless you specify that it shouldn't.

@RoyEJohnson RoyEJohnson force-pushed the search-navigation-issues branch from f0e562b to d73dd2e Compare June 5, 2024 16:55
].map((q) => document?.querySelector(q));

// Determine which region we are in (if any)
const currentSectionIndex = targets.findIndex((el) => el?.contains(document?.activeElement!));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd do something like document?.activeElement && el?.contains(document.activeElement) because activeElement can be null and idk if contains likes nulls or undefineds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null is ok for contains. activeElement can be undefined, but there's no good way to make it so. In general, it will be set to body if you blur it from anything else.
I changed document?activeElement! to document?activeElement ?? null but could not write a test to hit the undefined branch.

src/app/content/components/Topbar/index.tsx Outdated Show resolved Hide resolved
src/app/content/components/Topbar/index.tsx Outdated Show resolved Hide resolved
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-search-navigati-azbx5p June 28, 2024 12:42 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-azbx5p June 28, 2024 17:48 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-azbx5p June 28, 2024 20:06 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-azbx5p July 2, 2024 15:50 Inactive
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-search-navigati-9pdlw8 July 17, 2024 15:50 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-9pdlw8 July 18, 2024 12:51 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-9pdlw8 July 18, 2024 15:08 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-9pdlw8 July 18, 2024 15:48 Inactive
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-search-navigati-kls9b7 July 31, 2024 19:41 Inactive
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-search-navigati-vhqwz2 July 31, 2024 22:30 Inactive
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-search-navigati-wby8aa August 8, 2024 18:19 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-wby8aa August 8, 2024 18:23 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-wby8aa August 8, 2024 18:24 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-wby8aa August 8, 2024 18:24 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-search-navigati-wby8aa August 9, 2024 18:05 Inactive
@Malar-Natarajan Malar-Natarajan merged commit 7d7c586 into main Aug 9, 2024
8 of 9 checks passed
@Malar-Natarajan Malar-Natarajan deleted the search-navigation-issues branch August 9, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants