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

[General] Refactor and enable spatial navigation #869

Merged
merged 3 commits into from
Jan 5, 2022

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Jan 4, 2022

This PR adds the enable-spatial-navigation flag so the app can be navigated using the arrow keys so the keyboard accessibility is better (and this may enable the spatial navigation to use with the gamepad). The PR includes some refactoring that fixed the bugs with the browser's native spatial navigation, this way we don't have to use a javascript solution.

I had to make some refactoring to fix the spatial navigation:

  • the library screen header is not position: sticky, now the listings are wrapped in a div and that div has scroll, so the header won't break the spatial navigation
  • because of the previous change, I had to add a small fix to the install modal that was offset
  • I made a big refactor of the gameCard/gameListItem component so the same html works for both formats
  • I replaced some divs with spans, because the spatial navigation was focusing the divs too for some reason

I'll add some comments in the diff.

I tested moving around the app with the arrow keys, tried installing a game, cancelling the installation, opening a game details and executing a game.

EDIT: since I was already refactoring things on that screen, I did a small refactor to fix the back to top button that got missing and the html was duplicated


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jan 4, 2022
<Library showRecentsOnly library={recentGames} />
)}
<Library library={library} />
<div className="listing">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This allows me to remove the position: sticky of the header

}}
className="gameLogo"
/>
<img src={imageSrc} className={imgClasses} alt="cover" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved from a span to an img so it handles dimensions with the element, that helps with the dimensions of the wrapper a tag

@@ -4,6 +4,7 @@
width: var(--content-width);
height: 100%;
position: fixed;
top: 0px;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to add this fix after adding the .listings wrapper

@@ -48,6 +48,11 @@
animation: apparition 0.3s ease-in forwards;
}

.listing {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this puts the scroll here instead of in the .content element

max-height: 266px;
min-width: 130px;
min-height: 173px;
.gameCard > a {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are many changes in this file, some are new styles, some are just me moving things around so similar elements are together, and are refactors like moving width, min-width and max-width to a widh: clamp(...) property and things like that

Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

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

Tested here and works really good. Great job and thanks for that! :D

@flavioislima flavioislima changed the title Refactor and enable spatial navigation [General] Refactor and enable spatial navigation Jan 5, 2022
@flavioislima flavioislima merged commit b6ce8bd into main Jan 5, 2022
@flavioislima flavioislima deleted the spatial-navigation branch January 5, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants