Skip to content

Commit

Permalink
feat(Drawer): auto focus when drawer shown (#5211)
Browse files Browse the repository at this point in the history
* refactor: add auto focus logic

* refactor: 重构代码

* refactor: 精简代码

* chore: bump version 9.3.1-beta01
  • Loading branch information
ArgoZhang authored Jan 25, 2025
1 parent 3a8f822 commit 01b3e1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.3.0</Version>
<Version>9.3.1-beta01</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 5 additions & 6 deletions src/BootstrapBlazor/Components/Drawer/Drawer.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export function execute(id, open) {
requestAnimationFrame(show);
}
else {
drawerBody.classList.add('show')
drawerBody.classList.add('show');
el.focus();
}
}

Expand All @@ -123,11 +124,9 @@ export function execute(id, open) {
body.classList.add('overflow-hidden')
requestAnimationFrame(show)
}
else {
if (el.classList.contains('show')) {
drawerBody.classList.remove('show')
requestAnimationFrame(hide)
}
else if (el.classList.contains('show')) {
drawerBody.classList.remove('show')
requestAnimationFrame(hide)
}
}

Expand Down

0 comments on commit 01b3e1d

Please sign in to comment.