Skip to content

Commit 01b3e1d

Browse files
authored
feat(Drawer): auto focus when drawer shown (#5211)
* refactor: add auto focus logic * refactor: 重构代码 * refactor: 精简代码 * chore: bump version 9.3.1-beta01
1 parent 3a8f822 commit 01b3e1d

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.3.0</Version>
4+
<Version>9.3.1-beta01</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Drawer/Drawer.razor.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export function execute(id, open) {
100100
requestAnimationFrame(show);
101101
}
102102
else {
103-
drawerBody.classList.add('show')
103+
drawerBody.classList.add('show');
104+
el.focus();
104105
}
105106
}
106107

@@ -123,11 +124,9 @@ export function execute(id, open) {
123124
body.classList.add('overflow-hidden')
124125
requestAnimationFrame(show)
125126
}
126-
else {
127-
if (el.classList.contains('show')) {
128-
drawerBody.classList.remove('show')
129-
requestAnimationFrame(hide)
130-
}
127+
else if (el.classList.contains('show')) {
128+
drawerBody.classList.remove('show')
129+
requestAnimationFrame(hide)
131130
}
132131
}
133132

0 commit comments

Comments
 (0)