You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/FocusTrap/FocusTrap.razor

39 lines
996 B

2 years ago
@namespace Connected.Components
@inherits UIComponent
<div @ref="_root" @attributes="UserAttributes" class="@Classname" style="@Style" @onkeydown="OnRootKeyDown" @onkeyup="OnRootKeyUp" @onfocus="OnRootFocusAsync" tabindex="-1">
<div class="fixed pointer-events-none"
tabindex="@TrapTabIndex"
@onfocus="OnTopFocusAsync">
</div>
<div @ref="_firstBumper"
class="fixed pointer-events-none"
tabindex="@TrapTabIndex"
@onfocus="OnBumperFocusAsync">
</div>
<div @ref="_fallback"
class="fixed pointer-events-none"
tabindex="-1">
</div>
@ChildContent
<div @ref="_lastBumper"
class="fixed pointer-events-none"
tabindex="@TrapTabIndex"
@onfocus="OnBumperFocusAsync">
</div>
<div sclass="fixed pointer-events-none"
tabindex="@TrapTabIndex"
@onfocus="OnBottomFocusAsync">
</div>
</div>
@code {
string TrapTabIndex => (Disabled? "-1" : "0");
}