diff --git a/.changeset/moody-spies-behave.md b/.changeset/moody-spies-behave.md new file mode 100644 index 0000000000..7e1bae81e6 --- /dev/null +++ b/.changeset/moody-spies-behave.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/wonder-blocks-icon": patch +--- + +PhosphorIcon already support the tabIndex prop, this change updates the types to reflect that diff --git a/packages/wonder-blocks-icon/src/components/__tests__/phosphor-icon.test.tsx b/packages/wonder-blocks-icon/src/components/__tests__/phosphor-icon.test.tsx index 268e7f597f..10f997a20d 100644 --- a/packages/wonder-blocks-icon/src/components/__tests__/phosphor-icon.test.tsx +++ b/packages/wonder-blocks-icon/src/components/__tests__/phosphor-icon.test.tsx @@ -201,4 +201,15 @@ describe("PhosphorIcon", () => { }); }); }); + + it("supports `tabIndex`", async () => { + // Arrange + const ref: React.RefObject = React.createRef(); + + // Act + render(); + + // Assert + expect(ref.current).toHaveAttribute("tabindex", "-1"); + }); }); diff --git a/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx b/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx index 1c45b0324a..dfdbf5b751 100644 --- a/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx +++ b/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx @@ -41,6 +41,11 @@ type Props = Pick & { */ testId?: string; + /** + * Set the tabindex attribute on the rendered element. + */ + tabIndex?: 0 | -1; + /** * The icon to display. This is a reference to the icon asset (imported as a * static SVG file).