Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

make sure keydown even listeners work with caps lock

Steven Tey0d92ff6991dd
diff --git a/apps/web/ui/links/link-card.tsx b/apps/web/ui/links/link-card.tsx
index ec3d316f10..67573c409a 100644
--- a/apps/web/ui/links/link-card.tsx
+++ b/apps/web/ui/links/link-card.tsx
@@ -213,6 +213,7 @@ export default function LinkCard({
};
const onKeyDown = (e: any) => {
+ const key = e.key.toLowerCase();
// only run shortcut logic if:
// - usage is not exceeded
// - link is selected or the 3 dots menu is open
@@ -220,11 +221,11 @@ export default function LinkCard({
// - there is no existing modal backdrop
if (
(selected || openPopover) &&
- ["e", "d", "q", "a", "t", "i", "x"].includes(e.key)
+ ["e", "d", "q", "a", "t", "i", "x"].includes(key)
) {
setSelected(false);
e.preventDefault();
- switch (e.key) {
+ switch (key) {
case "e":
setShowAddEditLinkModal(true);
break;
diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsx
index 65c55b1f5c..76b5abf67a 100644
--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx
@@ -729,7 +729,7 @@ function AddEditLinkButton({
// - there is no existing modal backdrop (i.e. no other modal is open)
// - workspace has not exceeded links limit
if (
- e.key === "c" &&
+ e.key.toLowerCase() === "c" &&
!e.metaKey &&
!e.ctrlKey &&
target.tagName !== "INPUT" &&