Capture CTRL+L and CTRL+D sequence on Linux #7

Closed
opened 2025-01-31 13:03:02 +00:00 by Yehowshua · 2 comments
Owner

It seems that Browser.Events emits noDefault and stopPropagation - so it's unclear why we aren't able to capture certain sequences in Chrome or Firefox on Linux.

Maybe we start with a very simple test with pure HTML+JS code that tries to capture such sequences on Linux such as the following:

document.addEventListener("keydown", function(event) {
    if (event.ctrlKey && event.key.toLowerCase() === "l") {
        event.preventDefault(); // Prevents the browser from selecting the URL bar
        event.stopPropagation(); // Prevents bubbling to the browser
        console.log("Ctrl+L captured!"); // Handle your custom behavior here
    }
});

If that works, maybe build an Elm port around it?

It seems that Browser.Events emits noDefault and stopPropagation - so it's unclear why we aren't able to capture certain sequences in Chrome or Firefox on Linux. Maybe we start with a very simple test with pure HTML+JS code that tries to capture such sequences on Linux such as the following: ```js document.addEventListener("keydown", function(event) { if (event.ctrlKey && event.key.toLowerCase() === "l") { event.preventDefault(); // Prevents the browser from selecting the URL bar event.stopPropagation(); // Prevents bubbling to the browser console.log("Ctrl+L captured!"); // Handle your custom behavior here } }); ``` If that works, maybe build an Elm port around it?
Yehowshua self-assigned this 2025-01-31 13:03:02 +00:00
azkarim was assigned by Yehowshua 2025-01-31 13:03:02 +00:00
Collaborator

Sounds good!

Sounds good!
Author
Owner

To test for Linux behaviors, you can run Ubuntu in UTM on MacOS.

To test for Linux behaviors, you can run Ubuntu in UTM on MacOS.
azkarim added reference fix-ctrl-l 2025-01-31 15:01:51 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: ReferenceProjects/example-spa-elm-app#7
No description provided.