Skip to content

Commit

Permalink
chore: remove blur method
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed Jun 25, 2024
1 parent 632fad3 commit 6bd17f2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
9 changes: 0 additions & 9 deletions src/components/PinInput/PinInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type PinInputType = 'numeric' | 'alphanumeric';

export interface PinInputApi {
focus: () => void;
blur: () => void;
}

export interface PinInputProps extends DOMProps, AriaLabelingProps, QAProps {
Expand Down Expand Up @@ -240,14 +239,6 @@ export const PinInput = React.forwardRef<HTMLDivElement, PinInputProps>((props,
focus: () => {
refs.current[activeIndex]?.focus();
},
blur: () => {
if (
document.activeElement &&
document.activeElement === refs.current[activeIndex]
) {
refs.current[activeIndex]?.blur();
}
},
}),
[activeIndex],
);
Expand Down
1 change: 0 additions & 1 deletion src/components/PinInput/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ If you want the browser to suggest "one time codes" from the outer context (e.g.
## API

- `focus(): void` - Set focus to the current active input.
- `blur(): void` - Remove focus from the current active input.

## Properties

Expand Down
13 changes: 0 additions & 13 deletions src/components/PinInput/__tests__/PinInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,5 @@ describe('PinInput', () => {
});
expect(inputs[1]).toHaveFocus();
});

test('blur', async () => {
const user = userEvent.setup();
const apiRef: React.RefObject<PinInputApi> = {current: null};
renderComponent(<PinInput apiRef={apiRef} defaultValue={['0', '1', '2', '3']} />);

await user.click(inputs[1]);
expect(inputs[1]).toHaveFocus();
act(() => {
apiRef.current?.blur();
});
expect(inputs[1]).not.toHaveFocus();
});
});
});

0 comments on commit 6bd17f2

Please sign in to comment.