这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@hugoholgersson
Copy link
Collaborator

Run SpatNav on up/down (in Android TV's WebView)

Background:
Spatial Navigation is Chromium's DPAD-mechanics
that runs in Android WebView on Android TV and
if you run Chrome with --enable-spatial-navigation.
SpatNav runs as Chrome's default action on keydown.

Problem:
Once focus goes to a search box, DPAD_UP/DOWN
in Android TV's WebViews can not move focus
outside the search box. Focus gets trapped.

This happens because react-autosuggest always
prevents the default action (Spatial Navigation
in Android TV's WebViews).

Solution:
Do not prevent Spatial Navigation from running
when no suggestions are shown.

Testing done:

  1. npm start
  2. Quit Chrome.
  3. chrome --enable-spatial-navigation
    http://localhost:3000/demo/dist/index.html
  4. Ensure that the arrow keys can move between
    all fields and links.

Background:
Spatial Navigation is Chromium's DPAD-mechanics
that runs in Android WebView on Android TV and
if you run Chrome with --enable-spatial-navigation.
SpatNav runs as Chrome's default action on keydown.

Problem:
Once focus goes to a search box, DPAD_UP/DOWN
in Android TV's WebViews can not move focus
outside the search box. Focus gets trapped.

This happens because react-autosuggest *always*
prevents the default action (Spatial Navigation
in Android TV's WebViews).

Solution:
Do not prevent Spatial Navigation from running
when no suggestions are shown.

Testing done:
1) npm start
2) Quit Chrome.
3) chrome --enable-spatial-navigation
     http://localhost:3000/demo/dist/index.html
4) Ensure that the arrow keys can move between
   all fields and links.
@hugoholgersson
Copy link
Collaborator Author

@aberezkin, could you review this change? It unblocks Android TV.

@hugoholgersson
Copy link
Collaborator Author

@saltas888, could you review this change?

Especially, could you apply this change locally and try it out on your web site? Does this break anything for you?

Copy link
Collaborator

@pimterry pimterry left a comment

Choose a reason for hiding this comment

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

Hi @hugoholgersson! @moroshko gave me collaborator access too, I'm planning to do a run through of the PRs today and help clear things up a bit, thought I'd help here 😄. This would be a great fix, and would help towards closing out #522 and #602 as well. Just a couple of quick comments first.

@pimterry
Copy link
Collaborator

Looks great! 👍 👍 👍

@hugoholgersson
Copy link
Collaborator Author

Thanks @pimterry!

So let's to step up the package version so we can get this change out there? :) Do you have access to publish a new version to npm? I don't...

I see that https://www.npmjs.com/package/react-autosuggest mentions 10.0.2 as the last version. I don't know how this works because our package.json still says "version": "10.0.1". We should probably step it up to 10.0.3?

@pimterry
Copy link
Collaborator

So let's to step up the package version so we can get this change out there?

Yep, definitely aiming to do that today, I just want to wrap up #773 first, just need to finish some of the test markups.

Do you have access to publish a new version to npm?

I do! (I think, although I haven't tested it yet)

I see that npmjs.com/package/react-autosuggest mentions 10.0.2 as the last version. I don't know how this works because our package.json still says "version": "10.0.1". We should probably step it up to 10.0.3?

Oh boy, that's not great. Doing so digging in https://unpkg.com/browse/react-autosuggest@10.0.2/ to https://unpkg.com/browse/react-autosuggest@10.0.1/ and looking through the commits from back in May, it looks like 9f1ce67 was published as 10.0.2, but that package.json commit is on a branch, and not on the merged commit on master (which is here 43bd217). It's on the PR branch for #740, but committed & pushed after the branch was already merged, easy mistake to make.

I think it's probably best to leave the github tags as they are, given that (since there really is a correct 10.0.2 tag), but yes we should update straight to 10.0.3 when we release proper.

@pimterry
Copy link
Collaborator

Now published 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants