Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding keyEvent simulation to buttons. #146

Open
IhsenBen opened this issue Dec 2, 2023 · 0 comments
Open

Adding keyEvent simulation to buttons. #146

IhsenBen opened this issue Dec 2, 2023 · 0 comments

Comments

@IhsenBen
Copy link

IhsenBen commented Dec 2, 2023

I was wondering if you could expose pressed: boolean props to allow simulating pressing buttons with other events, something like this

const AwesomeButton = ({
  // ... existing props
  pressed = false,
}: ButtonType) => {
  // ... existing code

  useEffect(() => {
    if (pressed) {
      pressIn({} as React.MouseEvent);
    } else {
      pressOut({} as React.MouseEvent);
    }
  }, [pressed]);

  // ... existing code
}

I know that the active props already exits, but still, it doesn't fire the pressIn and pressOut functions, if you are ok with this, , I can work on the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant