Merge pull request #1487 from basecamp/hide-hotkeys

Hide hotkeys
This commit is contained in:
Jason Zimdars
2025-11-04 16:39:18 -06:00
committed by GitHub
7 changed files with 23 additions and 7 deletions
+14
View File
@@ -233,4 +233,18 @@
.hide-focus-ring {
--focus-ring-size: 0;
}
.hide-on-touch {
@media (any-hover: none) {
display: none;
}
}
.show-on-touch {
display: none;
@media (any-hover: none) {
display: unset;
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<div class="flex justify-center bar__placeholder" data-bar-target="buttonsContainer">
<%= tag.button class: "btn btn--plain", data: {
controller: "hotkey", action: "bar#search keydown.k@document->hotkey#click" } do %>
<span class="display-contents">Search <% if platform.desktop? -%><kbd>K</kbd><% end %></span>
<span class="display-contents">Search <kbd class="hide-on-touch">K</kbd></span>
<% end %>
</div>
@@ -1,7 +1,8 @@
<div class="collection-tools card">
<%= button_to collection_cards_path(collection), method: :post, class: "btn btn--link", form: { data: { turbo_frame: "_top" } }, data: { controller: "hotkey", action: "keydown.c@document->hotkey#click" } do %>
<%= icon_tag "add", class: "show-on-touch" %>
<span>Add a card</span>
<kbd>C</kbd>
<kbd class="hide-on-touch">C</kbd>
<% end %>
<hr class="separator--horizontal full-width" aria-hidden="true">
@@ -1,8 +1,9 @@
<div class="header__actions header__actions--start">
<% if collection = user_filtering.single_collection_or_first %>
<%= button_to collection_cards_path(collection), method: :post, class: "btn btn--link btn--circle-mobile", data: { controller: "hotkey", action: "keydown.c@document->hotkey#click" } do %>
<%= icon_tag "add", class: "show-on-touch" %>
<span>Add a card</span>
<kbd>C</kbd>
<kbd class="hide-on-touch">C</kbd>
<% end %>
<% end %>
</div>
+2 -2
View File
@@ -1,8 +1,8 @@
<%= tag.button class:"boxcar-menu-trigger input input--select center flex-inline gap-half align-center txt-normal",
<%= tag.button class:"boxcar-menu-trigger input input--select center flex-inline align-center txt-normal",
data: {
action: "click->dialog#open:stop keydown.j@document->hotkey#click keydown.meta+j@document->hotkey#click keydown.ctrl+j@document->hotkey#click",
controller: "hotkey" } do %>
<span><%= image_tag "logo.png" %></span>
<strong class="txt-medium overflow-ellipsis margin-none">Fizzy</strong>
<kbd class="kbd txt-xx-small">J</kbd>
<kbd class="kbd txt-xx-small margin-inline-start hide-on-touch">J</kbd>
<% end %>
+1 -1
View File
@@ -14,7 +14,7 @@
<button class="tray__toggle" data-action="dialog#toggle keydown.p@document->hotkey#click" data-controller="hotkey" aria-label="Toggle pins stack" aria-haspopup="true">
<div class="tray__toggle-btn txt-uppercase btn btn--reversed txt-x-small center full-width">
<%= icon_tag "pinned" %>
<span class="tray__toggle-text">Pinned <% if platform.desktop? -%><kbd>P</kbd><% end %></span>
<span class="tray__toggle-text">Pinned <kbd class="hide-on-touch">P</kbd></span>
</div>
</button>
</section>
+1 -1
View File
@@ -42,7 +42,7 @@
<button class="tray__toggle" data-action="dialog#toggle keydown.n@document->hotkey#click" data-controller="hotkey" aria-label="Toggle notifications stack" aria-haspopup="true">
<div class="tray__toggle-btn txt-uppercase btn btn--reversed txt-x-small center full-width">
<%= icon_tag "bell" %>
<span class="tray__toggle-text">Notifications <% if platform.desktop? -%><kbd>N</kbd><% end %></span>
<span class="tray__toggle-text">Notifications <kbd class="hide-on-touch">N</kbd></span>
</div>
</button>
</section>