Skip to content

Commit

Permalink
fix(button): Fix prop types (#134)
Browse files Browse the repository at this point in the history
* fix(button): Fix Button prop types

* Change forwardRef types.
* Remove explicit prop type in the component definition.
(TSC can detect the type automatically from forwardRef now.)

* fix(dropdown): Fix Dropdown prop types

* fix(passwordInput): Fix typo

* refactor(button): Remove ref property

ref property comes automatically with forwardRef usage.

* fix(dropdown): add combobox role

Co-authored-by: Anılerkan <[email protected]>
  • Loading branch information
mfarukkoc and Anlerkan authored Mar 11, 2022
1 parent 123025a commit 7d98256
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ export type ButtonProps = Omit<
shouldPreventDefault?: boolean;
shouldStopPropagation?: boolean;
shouldFocus?: boolean;
ref?: React.RefObject<HTMLButtonElement>;
shouldDisplaySpinner?: boolean;
customClassName?: string;
};

const Button = React.forwardRef<HTMLButtonElement, Record<string, any>>(
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
// eslint-disable-next-line prefer-arrow-callback
function ButtonComponent(props: ButtonProps, ref) {
function ButtonComponent(props, ref) {
const {
testid,
type = "button",
Expand Down
1 change: 1 addition & 0 deletions src/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ function Dropdown<OptionIdShape extends string>({
onMouseUp={handleMouseUp}
onClick={toggleDropdown}
tabIndex={-1}
// @ts-ignore
aria-haspopup={role}
aria-expanded={isMenuOpen}
shouldFocus={shouldFocusOnHeaderButton}>
Expand Down

0 comments on commit 7d98256

Please sign in to comment.