helpscout / hsds-react

Help Scout Design System (HSDS) — React Component Library
MIT License
86 stars 17 forks source link

Capture all keyboad originating in Simple Modal #1062

Closed TerrenceLJones closed 2 years ago

TerrenceLJones commented 2 years ago

Problem

Jira ticket

Keyboard events originating when the Simple Modal was displayed were leaking out onto the page, causing page keyboard shortcuts to be triggered.

Solutions

  1. Stop propagation of key and click events from the modal
  2. Add a blocksGlobalHotkeys prop to SimpleModal (and SidePanel) that will add a data attribute that external hooks or events can look for to perform or not a certain action when a modal is present

Other

  1. When having multiple modals on screen outside clicks were being firing 'onClose' for every modal, we added scenarios were we don't want this to happen, for example if having 2 modals open, and we click outside the modal on top, we only want to fire the onClose for that one, not the underneath one.

Unrelated

  1. Tooltip: removed some styles that were added to fix arrow positioning but now we've seen they cause issues when the tooltip is appended to anything but the default.
  2. DropList: little tweak to make the input on comboboxes always show the blue outline to avoid flashing when selecting items
cloudflare-pages[bot] commented 2 years ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b19ca83
Status: ✅  Deploy successful!
Preview URL: https://b30e667f.hsds-react.pages.dev

View logs