diff --git a/src/drawer/drawer.tsx b/src/drawer/drawer.tsx index 08df6d48c..0a0e94aa2 100644 --- a/src/drawer/drawer.tsx +++ b/src/drawer/drawer.tsx @@ -88,6 +88,9 @@ export default mixins(ActionMixin, getConfigReceiverMixins('d }, visible: { handler(val) { + if (val) { + (this.$refs.drawerContainer as HTMLDivElement).focus?.(); + } this.handleScrollThrough(val); }, }, @@ -112,6 +115,8 @@ export default mixins(ActionMixin, getConfigReceiverMixins('d style={{ zIndex: this.zIndex }} onkeydown={this.onKeyDown} v-transfer-dom={this.attach} + ref="drawerContainer" + tabindex={0} > {this.showOverlay &&
}
diff --git a/test/ssr/__snapshots__/ssr.test.js.snap b/test/ssr/__snapshots__/ssr.test.js.snap index d17d87fe6..3d4063068 100644 --- a/test/ssr/__snapshots__/ssr.test.js.snap +++ b/test/ssr/__snapshots__/ssr.test.js.snap @@ -3263,7 +3263,7 @@ exports[`ssr snapshot test renders ./examples/config-provider/demos/popconfirm.v
-
+
Drawer
@@ -3711,7 +3711,7 @@ exports[`ssr snapshot test renders ./examples/divider/demos/vertical.vue correct exports[`ssr snapshot test renders ./examples/drawer/demos/attach-parent.vue correctly 1`] = `
-
+
抽屉标题
@@ -3738,7 +3738,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/attach-parent.vue cor exports[`ssr snapshot test renders ./examples/drawer/demos/base.vue correctly 1`] = `
-
+
抽屉标题
@@ -3758,7 +3758,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/base.vue correctly 1` exports[`ssr snapshot test renders ./examples/drawer/demos/custom.vue correctly 1`] = `
-
+
@@ -3771,7 +3771,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/custom.vue correctly
-
+
抽屉标题
@@ -3784,7 +3784,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/custom.vue correctly
-
+
抽屉标题
@@ -3812,7 +3812,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/destroy.vue correctly exports[`ssr snapshot test renders ./examples/drawer/demos/no-mask.vue correctly 1`] = `
-
+
抽屉标题
@@ -3829,7 +3829,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/no-mask.vue correctly exports[`ssr snapshot test renders ./examples/drawer/demos/operation.vue correctly 1`] = `
-
+
抽屉标题
@@ -3855,7 +3855,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/operation.vue correct exports[`ssr snapshot test renders ./examples/drawer/demos/placement.vue correctly 1`] = `
-
+
抽屉标题
@@ -3876,7 +3876,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/placement.vue correct exports[`ssr snapshot test renders ./examples/drawer/demos/popup.vue correctly 1`] = `
-
+
抽屉标题
@@ -3898,7 +3898,7 @@ exports[`ssr snapshot test renders ./examples/drawer/demos/popup.vue correctly 1 exports[`ssr snapshot test renders ./examples/drawer/demos/size.vue correctly 1`] = `
-
+
抽屉标题
diff --git a/test/unit/drawer/__snapshots__/demo.test.js.snap b/test/unit/drawer/__snapshots__/demo.test.js.snap index a9b50a208..260afcc1b 100644 --- a/test/unit/drawer/__snapshots__/demo.test.js.snap +++ b/test/unit/drawer/__snapshots__/demo.test.js.snap @@ -9,6 +9,7 @@ exports[`Drawer Demo CurrentDOMModeUsageExample wroks fine 1`] = ` >