Skip to content

Commit ccaf138

Browse files
committed
fix(clone.helpers): preserve vertical-align from original input in checkbox/radio replacement (#311)
1 parent 13ab5c8 commit ccaf138

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/utils/clone.helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,13 @@ export function createCheckboxRadioReplacement(node) {
451451
const size = Math.max(Math.min(w, h), 12)
452452
const s = size
453453

454+
// #311: preserve original vertical-align so the replacement doesn't shift inline layout
455+
let vAlign = 'middle'
456+
try { if (cs && cs.verticalAlign) vAlign = cs.verticalAlign } catch { }
457+
454458
const box = document.createElement('div')
455459
box.setAttribute('data-snapdom-input-replacement', node.type || 'checkbox')
456-
box.style.cssText = `display:inline-block;width:${s}px;height:${s}px;vertical-align:middle;flex-shrink:0;line-height:0;`
460+
box.style.cssText = `display:inline-block;width:${s}px;height:${s}px;vertical-align:${vAlign};flex-shrink:0;line-height:0;`
457461
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
458462
svg.setAttribute('width', String(s))
459463
svg.setAttribute('height', String(s))

0 commit comments

Comments
 (0)