Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Conversation

@hojberg
Copy link
Member

@hojberg hojberg commented May 7, 2021

Overview

Enable the user to click "Keyboard Shortcuts" in the lower left of the
sidebar or press "?" on the keyboard to open a modal with the
keyboard shortcuts

Screen Shot 2021-05-07 at 16 55 29

Fixes #86 and #80

Implementation notes

  • Add a HelpModal for all help related topics (just keyboard shortcuts for now)
  • Add a System model, companioned by a JavaScript module for detecting
    the Operating System of the client to allow for "Meta" to be
    translated to the Windows key and Cmd key appropriately
  • Disable Meta+k for any Operating System thats not macOS
  • Render Meta Key correctly depending on Operating System
  • Fix a modal issue in Firefox where modals where full height instead of
    fitted to their content.
  • Update the KeyboardShortcut module to support a modal compositional
    way to construct shortcut indicators if needed
  • Refactor the Modal module to better support different kinds of modals
    with clear defaults (Finder is a uniquely styled modal and the new
    Help modal will be default style).

Interesting/controversial decisions

Dealing with the OS is a bit of a pain, and Firefox apparently handles the windows key
in a weird way (though slated to be fixed at some point).

I'm doing the OS detecting in JS only right now, but this could be moved to Elm by passing in
window.navigator as flags. This is then passed to KeyboardShortcut init to make it easy to always
have the OS handy when rendering shortcuts.

This could alternatively be done with ports and have the KeyboardShortcut module fetch
the os from JavaScript land on init, but that mean dealing with the value being async.

@hojberg hojberg requested a review from pchiusano May 7, 2021 21:06
* Enable the user to click "Keyboard Shortcuts" in the lower left of the
  sidebar or press "?" to open the new HelpModal which (for now, only)
  includes the keyboard shortcut list
* Add a System model, companioned by a JavaScript module for detecting
  the Operating System of the client to allow for "Meta" to be
  translated to the Windows key and Cmd key appropriately
* Disable Meta+k for any Operating System thats not macOS
* Render Meta Key correctly depending on Operating System
* Fix a modal issue in Firefox where modals where full height instead of
  fitted to their content.
* Update the KeyboardShortcut module to support a modal compositional
  way to construct shortcut indicators if needed
* Refactor the Modal module to better support different kinds of modals
  with clear defaults (Finder is a uniquely styled modal and the new
  Help modal will be default style).
@hojberg hojberg force-pushed the show-keyboard-shortcuts-modal branch from 9e4e4c2 to c90847b Compare May 7, 2021 21:08
Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Annoying that it's this complicated though.

@hojberg hojberg merged commit 64e4163 into main May 7, 2021
@hojberg hojberg deleted the show-keyboard-shortcuts-modal branch May 7, 2021 21:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Fuzzy Finder is full height in Firefox instead of collapsing to the height of the content

3 participants