Repository navigation
fix(touchable-ripple): use the MD3 hover opacity on web - #5320
Open
Priyanshu0007 wants to merge 1 commit into
Open
Priyanshu0007 wants to merge 1 commit into
Priyanshu0007 wants to merge 1 commit into
Conversation
The web hover layer halved the ripple's alpha, so a content ripple at the pressed opacity (0.1) hovered at 0.05. Scale it by the hovered to pressed ratio instead, giving the content color at 0.08. Fixes callstack#5308
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
On web, TouchableRipple's hover layer halved the ripple opacity, so IconButton, Button and the default TouchableRipple hovered at 0.05, not MD3's 0.08. It now scales by the hovered/pressed tokens (0.08/0.1). A custom
rippleColorhovers at 0.8× its opacity. Native is unchanged.Related issue
Fixes #5308
Screenshots / Videos
Web (before 0.05 → after 0.08)
https://github.com/user-attachments/assets/47bc50af-40ef-460c-8114-3b625fe858aa
https://github.com/user-attachments/assets/f2e96243-76b0-4b20-92a7-40806f8f43e6
iOS (unchanged)
https://github.com/user-attachments/assets/052aa683-b5fe-4063-9809-d427335db392
https://github.com/user-attachments/assets/810e7f2f-a05d-40b6-ae50-b59ac31343e5
Android (unchanged)
https://github.com/user-attachments/assets/274bb503-2868-41ed-8659-2b0bc5169183
https://github.com/user-attachments/assets/76c580dd-5a80-49c8-8e06-be574cbb0890
Test plan
On web, hover a tonal IconButton: its background is the icon color at 0.08.