Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions .changeset/moody-spies-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/wonder-blocks-icon": patch
---

PhosphorIcon already support the tabIndex prop, this change updates the types to reflect that
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,15 @@ describe("PhosphorIcon", () => {
`mask-image: url(${customIcon});`,
);
});

it("supports `tabIndex`", async () => {
// Arrange
const ref: React.RefObject<HTMLSpanElement> = React.createRef();

// Act
render(<PhosphorIcon icon={Plus} ref={ref} tabIndex={-1} />);

// Assert
expect(ref.current).toHaveAttribute("tabindex", "-1");
});
});
5 changes: 5 additions & 0 deletions packages/wonder-blocks-icon/src/components/phosphor-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ type Props = Pick<AriaProps, "aria-hidden" | "aria-label" | "role"> & {
*/
testId?: string;

/**
* Set the tabindex attribute on the rendered element.
*/
tabIndex?: number;

/**
* The icon to display. This is a reference to the icon asset (imported as a
* static SVG file).
Expand Down
Loading