bestguy / sveltestrap

Bootstrap 4 & 5 components for Svelte
https://sveltestrap.js.org
MIT License
1.3k stars 183 forks source link

Support `keyboard` option of Offcanvas #561

Open RoryDuncan opened 1 year ago

RoryDuncan commented 1 year ago

The current implementation of Offcanvas does not allow you to opt out of the keyboard control (aka, pressing ESC closes the offcanvas). It is called keyboard within the Bootstrap Offcanvas options.

It seems the functionality would be pretty simple to add—I can contribute the changes if I find a moment.

Work Effort

  1. Add export let keyboard = true; to Offcanvas.svelte
  2. Update Offcanvas.d.ts to have the keyboard: boolean prop.
  3. Update Offcanvas.svelte to only add the bodyEvent event listener if keyboard is true.