aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/static/js/keyboard_handler.js (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-03-20Replace a bunch of `let` with `const`Gravatar jvoisin 1-4/+4
According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const > Many style guides (including MDN's) recommend using const over let whenever a variable is not reassigned in its scope. This makes the intent clear that a variable's type (or value, in the case of a primitive) can never change.
2024-03-10Use a `Set` instead of an array in a KeyboardHandler's memberGravatar jvoisin 1-3/+3
The variable `triggers` is only used to check if in contains a particular value. Given that the number of keyboard shortcuts is starting to be significant, let's future-proof the performances and use a `Set` instead of an `Array` instead.
2024-03-01Move search form to a dedicated pageGravatar Frédéric Guillot 1-2/+1
2024-02-21Add 'Enter' key as a hotkey to open selected itemGravatar Robert Lützner 1-1/+5
There are a few things that need to be done, to make this work. First, we need to register `Enter` as another hotkey that opens the selected item. However, by default the `KeyboardHandler` will override all default actions. That might make sense for any other key, but for the `Enter` key, we want to keep the default behavior (i.e. follow a selected link or press a button). So for this single key event, we do not call `preventDefault()`. I see this as unproblematic for the following reasons. 1. With the changes from #2348, when we're in a list of items (articles, categories, feeds), there is no link selected. This is what made the `Enter` key work _implicitly_ in the past. With nothing selected, the `Enter` key will do nothing by default. 2. If we have **any** link selected (including when we are in a view with a list of selectable items), we'll get the default action of `Enter` (i.e. follow a link), which is exactly what we had before. Lastly, we need to update the list of keyboard shortcuts displayed when pressing `?`. This fixes #2366.
2023-08-10Move internal packages to an internal folderGravatar Frédéric Guillot 1-0/+72
For reference: https://go.dev/doc/go1.4#internalpackages