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 spatial navigation to controller page #174

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

knuton
Copy link
Member

@knuton knuton commented Aug 29, 2024

Adds spatial navigation via the focus-shift library.

Currently it is not possible to tick radio buttons/checkboxes, because this would require pressing Space. We could use the same method as in the apps to perform a synthetic click when Enter is pressed:

document.addEventListener('keydown', (event) => {
    if (event.key === 'Enter') {
      const activeElement = document.activeElement;
      if (activeElement instanceof HTMLInputElement &&
          (activeElement.type === 'checkbox' || activeElement.type === 'radio')) {
          activeElement.click();
          event.preventDefault();
      }
    }
});

It doesn't make a practical difference right now, because one cannot do anything with the checkbox-unfolded sections (network settings, requiring inputs).

Checklist

  • Changelog updated
  • Code documented
  • User manual updated

@knuton knuton added the reviewable Ready for initial or iterative review label Aug 29, 2024
@knuton knuton requested a review from guyonvarch August 29, 2024 13:13
@guyonvarch
Copy link
Member

Working great overall!

I can’t update select inputs, I need to press Space:

image

@guyonvarch
Copy link
Member

We can’t scroll through the Changelog, we may need a specific component, when having the focus, pressing down would scroll down, and pressing up would scroll up.

image

We could think about that later if we want to make it work as well as with a mouse.

@guyonvarch guyonvarch added details needed Further information requested to better evaluate changes and removed reviewable Ready for initial or iterative review labels Sep 2, 2024
@guyonvarch
Copy link
Member

We don’t have a package manager to deal with the focus-shift dependency, I think that’s OK. But I couldn’t find the version.

It could be on the header of the file, or in the filename.

@knuton
Copy link
Member Author

knuton commented Sep 2, 2024

We don’t have a package manager to deal with the focus-shift dependency, I think that’s OK. But I couldn’t find the version.

It's in the commit: e2a2dbe

@knuton
Copy link
Member Author

knuton commented Sep 2, 2024

I can’t update select inputs, I need to press Space:

That's interesting, it worked for me. Which browser is that with?

@guyonvarch
Copy link
Member

It's in the commit: e2a2dbe

OK, though it would be more visible in the filename, or in the header of the file, more in the face.

@guyonvarch
Copy link
Member

That's interesting, it worked for me. Which browser is that with?

With firefox. But testing using the kiosk, which is the target browser, it works as expected.

@guyonvarch
Copy link
Member

Wondering if Shutdown could be part of the list, so that going up from Shutdown would go to Changelog.

2024-09-03_11-59-10.mp4

@guyonvarch
Copy link
Member

On the Print label page, we can access any field, and also increase and decrease labels, but we sometimes have to find a path:

2024-09-03_12-02-54.mp4

We can let the entire sidebar be an 'active' focus group, so that moving
from the 'Shutdown' item to the other item group is more natural.
'Shutdown' is an item that will simply never be active itself.
@knuton
Copy link
Member Author

knuton commented Sep 5, 2024

OK, though it would be more visible in the filename, or in the header of the file, more in the face.

Agree that in your face is good, but have an uneasy feeling with header (because it requires editing the file) and filename (SHA fragments are not self-documenting, and we don't currently have tagged versions of focus-shift -- maybe that's the problem). Wonder if we could use Nix to bring in the dependency instead.

Would leave as is for now. It's not ideal, but it's low overhead and seems manageable as long as there is one single JS dependency we control.

I can explore using Nix (or Bower? 😄) if you think the commit message is too out of sight.

Or we make a versioned release of focus-shift and vendor that with version in filename.

With firefox. But testing using the kiosk, which is the target browser, it works as expected.

I checked, we have the same issue with Firefox in Play.

We can look into extending the glue to map Enter to Space a click there, and we can also use it here. I am still not convinced this glue should be part of the focus-shift library -- though at least in the way we use it, we would always want both the spatial navigation and the extended Enter key support.

On the Print label page, we can access any field, and also increase and decrease labels, but we sometimes have to find a path:

We can just drop that part of the controller, I think.

Wondering if Shutdown could be part of the list, so that going up from Shutdown would go to Changelog.

Yes, it can, thanks! 5b5257a

@knuton
Copy link
Member Author

knuton commented Sep 5, 2024

On the Print label page, we can access any field, and also increase and decrease labels, but we sometimes have to find a path:

We can just drop that part of the controller, I think.

#175

Copy link
Member

@guyonvarch guyonvarch left a comment

Choose a reason for hiding this comment

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

We can look into extending the glue to map Enter to Space a click there, and we can also use it here. I am still not convinced this glue should be part of the focus-shift library -- though at least in the way we use it, we would always want both the spatial navigation and the extended Enter key support.

I would let things as it is for the moment, and maybe come to this later.

Yes, it can, thanks! 5b5257a

👍

Or we make a versioned release of focus-shift and vendor that with version in filename.

That should be the simplest thing to do, voting for this. I created an issue to track this.

@guyonvarch guyonvarch merged commit 2befad4 into dividat:main Sep 6, 2024
5 checks passed
@guyonvarch guyonvarch removed the details needed Further information requested to better evaluate changes label Sep 6, 2024
@knuton knuton deleted the add-spatial-navigation branch September 6, 2024 09:42
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