Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 8bcfde9

Browse files
authored
Fix credit card validation errors alignment (#2662)
* Use same margin-bottom in credit card input as in checkout inputs * Set cursor:text for Checkout input labels * Increase line height of expiry and cvc input validation errors in large viewports * Increase height of expiry and cvc input validation errors in small viewports
1 parent cc913e0 commit 8bcfde9

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

assets/js/base/components/payment-methods/style.scss

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
.wc-block-gateway-container {
5757
position: relative;
58-
margin-bottom: $gap;
58+
margin-bottom: em($gap-large);
5959
white-space: nowrap;
6060

6161
&.wc-card-number-element {
@@ -81,6 +81,7 @@
8181
box-sizing: border-box;
8282
height: 3em;
8383
color: $input-text-active;
84+
cursor: text;
8485

8586
&:focus {
8687
background-color: #fff;
@@ -106,6 +107,7 @@
106107
overflow: hidden;
107108
text-overflow: ellipsis;
108109
max-width: calc(100% - #{2 * $gap});
110+
cursor: text;
109111

110112
@media screen and (prefers-reduced-motion: reduce) {
111113
transition: none;
@@ -149,6 +151,29 @@
149151
}
150152
}
151153

154+
// These elements have available space below, so we can display errors with a
155+
// larger line height.
156+
.is-medium,
157+
.is-large {
158+
.wc-card-expiry-element,
159+
.wc-card-cvc-element {
160+
.wc-block-form-input-validation-error > p {
161+
line-height: 16px;
162+
padding-top: 4px;
163+
}
164+
}
165+
}
166+
167+
.is-mobile,
168+
.is-small {
169+
.wc-card-expiry-element,
170+
.wc-card-cvc-element {
171+
.wc-block-form-input-validation-error > p {
172+
min-height: 28px;
173+
}
174+
}
175+
}
176+
152177
.wc-blocks-credit-card-images {
153178
padding-top: $gap-small;
154179
display: flex;

assets/js/base/components/text-input/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
overflow: hidden;
1919
text-overflow: ellipsis;
2020
max-width: calc(100% - #{2 * $gap});
21+
cursor: text;
2122

2223
@media screen and (prefers-reduced-motion: reduce) {
2324
transition: none;

0 commit comments

Comments
 (0)