fix: .mps-button squished on <button> elements — normalize box model

Per fox: Add To Cart / Make an offer buttons looked squished (text
crammed at top, little vertical space) while .mps-button on <a>
elements (cart page) looked fine.

Root cause: <button> elements inherit UA-stylesheet line-height and
box-sizing that differ from <a>. The class set padding-top/bottom: 14px
but with the native button line-height the text didn't center properly.

Normalized .mps-button:
- appearance: none (+ -webkit-) — strip native button chrome
- box-sizing: border-box — consistent across <button>/<a>/<input>
- font-family: inherit — buttons default to a different font
- line-height: 1.4 — explicit, was relying on UA "normal"
- padding: 12px 16px (was 14px 0) — symmetric, gives horizontal
  breathing room too
- vertical-align: middle

Now <button class="mps-button">, <a class="mps-button">, and
<input type=submit class="mps-button"> all render the same.

Tests pass (9 in pricing_mode slice).
This commit is contained in:
russell@unturf.com 2026-05-11 08:19:18 -04:00
parent 08ba11ab9d
commit 8853a5aa08
No known key found for this signature in database

View file

@ -727,22 +727,30 @@ pre, code {
}
.mps-button {
/* Normalize so <button>, <a>, and <input type=submit> with this
class render identically without these, <button> elements
inherit UA line-height/box-sizing and render squished. */
-webkit-appearance: none;
appearance: none;
box-sizing: border-box;
border: 2px solid transparent;
border-radius: var(--radius-sm, 4px);
color: white;
background-color: #D4D0C8;
display: inline-block;
font-family: inherit;
font-size: var(--text-sm, 14px);
font-weight: var(--weight-bold, bold);
line-height: 1.4;
min-width: 100%;
margin-top: var(--space-1, 4px);
margin-bottom: var(--space-1, 4px);
padding-top: 14px;
padding-bottom: 14px;
padding: 12px 16px;
text-align: center;
text-decoration: none;
white-space: nowrap;
cursor: pointer;
vertical-align: middle;
}
[data-theme="dark"] .mps-button {