diff --git a/src/AjaxUploader.tsx b/src/AjaxUploader.tsx index 0244c3be..62f61b77 100644 --- a/src/AjaxUploader.tsx +++ b/src/AjaxUploader.tsx @@ -368,10 +368,15 @@ class AjaxUploader extends Component { onMouseLeave, onDrop: this.onFileDrop, onDragOver: this.onFileDragOver, - tabIndex: hasControlInside ? undefined : '0', + tabIndex: hasControlInside || !openFileDialogOnClick ? undefined : '0', }; return ( - + { expect(container.querySelector('span')!).not.toHaveAttribute('role', 'button'); }); + it("Should not be focusable and doesn't have role=button when click upload is disabled", () => { + const { container } = render(); + + expect(container.querySelector('span')!.tabIndex).not.toBe(0); + expect(container.querySelector('span')!).not.toHaveAttribute('role', 'button'); + }); + it('should receive same defaultRequest as src', done => { const { default: srcRequest } = require('../src/request'); let receivedDefaultRequest: any;