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

[Feature Request] Support for onClick() again #4545

Open
minerCodeMaster opened this issue Jan 13, 2025 · 3 comments
Open

[Feature Request] Support for onClick() again #4545

minerCodeMaster opened this issue Jan 13, 2025 · 3 comments

Comments

@minerCodeMaster
Copy link

Is your feature request related to a problem? Please describe.

On mobile devices, the onPress() event doesn't work and doesn't trigger anything. It was not really a problem before because you could just use onClick() but now it is deprecated. onClick() is still working, but it's weird to get warnings from somthing, you need to use for normal usability.

Describe the solution you'd like

It would be great to support onClick() again.

Describe alternatives you've considered

I'm still using onClick() but I'm getting the deprecated warnings.

Screenshots or Videos

No response

Copy link

linear bot commented Jan 13, 2025

@wingkwong
Copy link
Member

On mobile devices, the onPress() event doesn't work and doesn't trigger anything

can you elaborate more which component and which versions are you using?

Regarding supporting onClick again, we understand this may cause the inconvenience. Please note that this is the decision made by the react-aria team. We need to follow the same approach to avoid incompatibility. You may check out why here if you're interested.

@AnYiEE
Copy link
Contributor

AnYiEE commented Jan 13, 2025

onPress is an event implemented by react-aria that modifies many native events. This means that if downstream components use onClick instead of onPress, various issues may arise, such as the child component's onClick event being blocked by the parent.

Even when using onPress, I still encounter several problems (for example, poor responsiveness when clicking near the edges of elements on mobile devices). In contrast, onClick is very stable; mixing it with onPress doesn't seem to cause major issues—only minor accessibility-related concerns—but I prefer to prioritize typical scenarios.

My approach has been to fix certain dependency versions. So far, everything works well even with the latest NextUI (although there are deprecation warnings, they don't have any actual impact since warnings and handling logic are separated; the handling logic is in newer versions of use-aria-button and use-aria-link).

"pnpm": {
	"overrides": {
		"@react-aria/interactions@^3.22.3": "3.22.2",
		"@nextui-org/use-aria-button@^2.2.3": "2.2.2",
		"@nextui-org/use-aria-link@^2.2.3": "2.2.2"
	}
}

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

3 participants