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

Fix #2701: Do not show shortcut box when modifier key is pressed #2721

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

mpsijm
Copy link
Contributor

@mpsijm mpsijm commented Sep 25, 2024

The fix itself (first commit) was quite easy to add 😄

While I was at it, I also implemented an additional quality-of-life feature, for the following scenario:

  • Use keyboard shortcuts to navigate to a specific entity (e.g. s42 for submission with ID 42)
  • Use the browser back button (or mouse button 4)

In this scenario, it used to be the case that the "shortcut box" would stay visible. With the second commit, I make sure that the shortcut state is reset before performing the redirect, to make sure that it does not linger when moving back to the previous page.

Tested locally with this diff, see #1072 and #2588
diff --git a/judge/create_cgroups.in b/judge/create_cgroups.in
index 56d1338a3..a36eb8c00 100755
--- a/judge/create_cgroups.in
+++ b/judge/create_cgroups.in
@@ -16,8 +16,9 @@ cgroup_error_and_usage () {
        On modern distros (e.g. Debian bullseye and Ubuntu Jammy Jellyfish) which have cgroup v2 enabled by default,
        you need to add 'systemd.unified_cgroup_hierarchy=0' as well.
     2. Run update-grub
-    3. Reboot" >&2
-    exit 1
+    3. Reboot
+    (ignoring for now, hehe)" >&2
+    exit 0
 }
 
 for i in cpuset memory; do

@eldering
Copy link
Member

* Use the browser back button (or mouse button 4)
  It used to be the case that the "shortcut box" would stay visible. With the second commit, I make sure that the shortcut state is reset before performing the redirect, to make sure that it does not linger when moving back to the previous page.

Hmmm, could this have been related to the weird behaviour when using back/forward buttons and these keyboard shortcuts I saw in Astana, going to the wrong page @meisterT ?

@meisterT
Copy link
Member

Use keyboard shortcuts to navigate to a specific entity (e.g. s42 for submission with ID 42)

This should have worked already, so I am wondering what you fixed in this regard.

@mpsijm
Copy link
Contributor Author

mpsijm commented Sep 27, 2024

In the second commit in this branch, I prevent the shortcut box from staying visible when going back in the browser history. Here are some screen recordings to show what happens. In both recordings, I press c and Enter, and click "Back".

Before d0a14d8 (the "c" reappears after clicking "back") After d0a14d8 (when clicking "back", the "c" is gone)
https://github.com/user-attachments/assets/cf61bcb2-31c1-46a9-a6be-ee7efea5665b https://github.com/user-attachments/assets/0f377e02-3202-409e-be8a-20107aaea839

@meisterT
Copy link
Member

Beautiful, thanks!

@meisterT meisterT added this pull request to the merge queue Sep 27, 2024
Merged via the queue into DOMjudge:main with commit a277691 Sep 27, 2024
25 of 26 checks passed
@mpsijm mpsijm deleted the 2701-keyboard-shortcuts-modifier-keys branch September 27, 2024 19:27
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.

3 participants