Skip to content

Commit

Permalink
fix: 修复 dialog plugin 聚焦 button 通过键盘频繁触发问题
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin committed Mar 3, 2022
1 parent 11bad48 commit 41a236c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dialog/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ const createDialog: DialogPlugin = (props: DialogOptions) => {
const dialogRef = React.createRef<DialogInstance>();
const options = { ...props };
const div = document.createElement('div');
ReactDOM.render(<DialogComponent {...(options as DialogProps)} visible={true} ref={dialogRef} isPlugin />, div);
ReactDOM.render(
<DialogComponent {...(options as DialogProps)} visible={true} ref={dialogRef} isPlugin />,
div,
() => {
(document.activeElement as HTMLElement).blur();
},
);
const container = getAttach(options.attach);
if (container) {
container.appendChild(div);
Expand Down

0 comments on commit 41a236c

Please sign in to comment.