Actions
use:trapfocus Restricts the keyboard focus to only select elements within the current elementExample
Try tabbing through the buttons, you should only be able to focus the inside buttons once you enter.
<script>
import { trapfocus } from "svaria";
</script>
<button>Outside button 1</button>
<div use:trapfocus>
<button>Inside button 1</button>
<button>Inside button 2</button>
<button>Inside button 3</button>
</div>
<button>Outside button 2</button>