From 05e65b3e3d499ded6d2c23d9db8d41c94c4486c4 Mon Sep 17 00:00:00 2001
From: Tresau-IBM <148357638+Tresau-IBM@users.noreply.github.com>
Date: Thu, 9 Nov 2023 14:09:25 -0500
Subject: [PATCH] fix: BreadcrumbItem aria-current PropType fix (#15052)
* feat: add types for Breadcrumbs
* revert: undo PropType changes and supress TS error instead
* fix: update 'aria-current' to match standards
The PropType definition for 'aria-current' is to broad.
Update the PropType to match AriaAttributes['aria-current']
BREAKING CHANGE: PropType is changed to be more specific
* fix: update snapshot
---
README.md | 179 ++++++++++++++++++
.../__snapshots__/PublicAPI-test.js.snap | 15 +-
.../components/Breadcrumb/BreadcrumbItem.tsx | 14 +-
3 files changed, 204 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 44ca44dd5d0a..f91e7a582750 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,185 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
+
+
diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
index a88fa2de4e46..0ad9cb74e2f4 100644
--- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
+++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
@@ -211,10 +211,21 @@ Map {
"args": Array [
Array [
Object {
- "type": "string",
+ "type": "bool",
},
Object {
- "type": "bool",
+ "args": Array [
+ Array [
+ "false",
+ "true",
+ "page",
+ "step",
+ "location",
+ "date",
+ "time",
+ ],
+ ],
+ "type": "oneOf",
},
],
],
diff --git a/packages/react/src/components/Breadcrumb/BreadcrumbItem.tsx b/packages/react/src/components/Breadcrumb/BreadcrumbItem.tsx
index f1207286cb17..f044c20a4608 100644
--- a/packages/react/src/components/Breadcrumb/BreadcrumbItem.tsx
+++ b/packages/react/src/components/Breadcrumb/BreadcrumbItem.tsx
@@ -103,8 +103,18 @@ const BreadcrumbItem: ForwardRefReturn =
BreadcrumbItem.displayName = 'BreadcrumbItem';
BreadcrumbItem.propTypes = {
- // @ts-expect-error - v12 TODO: BREAKING: This should match AriaAttributes['aria-current']
- 'aria-current': PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
+ 'aria-current': PropTypes.oneOfType([
+ PropTypes.bool,
+ PropTypes.oneOf([
+ 'false',
+ 'true',
+ 'page',
+ 'step',
+ 'location',
+ 'date',
+ 'time',
+ ] as const),
+ ]),
/**
* Pass in content that will be inside of the BreadcrumbItem