-
Notifications
You must be signed in to change notification settings - Fork 317
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
fix(Button): dispatch onclick event on edge #1862
base: master
Are you sure you want to change the base?
Conversation
--button-scale-factor: 0.95; | ||
transform: scale(var(--button-scale-factor)) translate3d(0, 0, 0); | ||
margin: calc(1% * (1 - var(--button-scale-factor))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes other elements on the screen to be shifted when the button is pressed:
Screen.Recording.2024-01-02.at.11.35.41.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check the issue again.
Do you have a visual testing tool, such as Applitool or Percy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we use Chromatic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two potential solutions:
- adding a DOM element as a wrapper
- replace the scale reduction with box shadow
I don't like both changes because they change the original design or impact performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree, it's a tricky one 💭
@@ -9,7 +9,7 @@ function renderComponent(props) { | |||
return render(<Button {...props}>{text}</Button>); | |||
} | |||
|
|||
describe("<Buttoon />", () => { | |||
describe("<Button />", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Yaronglp ! That's a really interesting direction, I wonder if we can tweak it a bit so it won't affect other elements
Description
The button doesn't dispatch on click event when clicking on the button's edge.
Issue #1766
Symptoms
Clicking on the Button component causes the edges of the button to move inward before the click event can be fully registered.
Solution
The added margin calculation compensates for the button's size reduction due to scaling.