From 7a2f4056e52b0c6df80020e1648dac12b0f7c313 Mon Sep 17 00:00:00 2001 From: Roland Groza Date: Sun, 1 May 2022 21:28:32 +0800 Subject: [PATCH] fix: use aria role `presentation` by default and close #1152 --- src/__snapshots__/index.spec.js.snap | 2 +- src/index.js | 2 +- src/index.spec.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__snapshots__/index.spec.js.snap b/src/__snapshots__/index.spec.js.snap index 7121b1e9..7376fdcd 100644 --- a/src/__snapshots__/index.spec.js.snap +++ b/src/__snapshots__/index.spec.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"
"`; +exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"
"`; diff --git a/src/index.js b/src/index.js index 5c0f9c7b..21df4c32 100755 --- a/src/index.js +++ b/src/index.js @@ -885,7 +885,7 @@ export function useDropzone(props = {}) { composeEventHandlers(onDragLeave, onDragLeaveCb) ), onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)), - role: typeof role === "string" && role !== "" ? role : "button", + role: typeof role === "string" && role !== "" ? role : "presentation", [refKey]: rootRef, ...(!disabled && !noKeyboard ? { tabIndex: 0 } : {}), ...rest, diff --git a/src/index.spec.js b/src/index.spec.js index 37024e71..e452eee9 100644 --- a/src/index.spec.js +++ b/src/index.spec.js @@ -3408,7 +3408,7 @@ describe("useDropzone() hook", () => { expect(container.querySelector("#root")).toHaveAttribute( "role", - "button" + "presentation" ); });