Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */
import type { ReactElement } from 'react';
import React, { Component } from 'react';
import classNames from 'classnames';
import pickAttrs from 'rc-util/lib/pickAttrs';
Expand Down Expand Up @@ -46,11 +44,14 @@ class AjaxUploader extends Component<UploadProps> {
if (!el) {
return;
}
const { children, onClick } = this.props;
if (children && (children as ReactElement).type === 'button') {

const target = e.target as HTMLElement;
const { onClick } = this.props;

if (target && target.tagName === 'BUTTON') {
const parent = el.parentNode as HTMLInputElement;
parent.focus();
parent.querySelector('button').blur();
target.blur();
}
el.click();
if (onClick) {
Expand Down