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

fix(Button): dispatch onclick event on edge #1862

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Button/Button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ $disabled-on-primary-color-opacity: 0.5;
}

.button:active:not(.preventClickAnimation) {
transform: scale(0.95) translate3d(0, 0, 0);
--button-scale-factor: 0.95;
transform: scale(var(--button-scale-factor)) translate3d(0, 0, 0);
margin: calc(1% * (1 - var(--button-scale-factor)));
Comment on lines +77 to +79
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we use Chromatic

Copy link
Contributor Author

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.

Copy link
Member

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 💭

}

.button .leftIcon {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/__tests__/button.jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function renderComponent(props) {
return render(<Button {...props}>{text}</Button>);
}

describe("<Buttoon />", () => {
describe("<Button />", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

let clickActionStub;
let onMouseDownStub;
let buttonComponent;
Expand Down
Loading