Skip to content

Commit

Permalink
Fix single checkbox bug (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
awidener3 authored Sep 19, 2024
1 parent 4139ccf commit f49f1f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next version

- Put your changes here...
- Fixed a visual bug that occurred when single checkbox elements had extra elements included.

## 4.0.1

Expand Down
9 changes: 8 additions & 1 deletion semanticForms.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions semanticForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ window.semanticForms = () => {
input.parentNode.classList.add('singleCheckbox')
newLabel.className = ''
label.setAttribute('hidden', 'hidden')
insertAfter(newLabel, input)
}

newLabel.innerHTML = label.innerHTML
Expand Down
12 changes: 10 additions & 2 deletions semanticForms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ form.semanticForms {
background: var(--nestedInput);
}
}

}

dl {
Expand All @@ -105,14 +104,23 @@ form.semanticForms {
position: relative;

&:not(.checkboxes, .radios) {
display: flex;
gap: 10px;
max-width: 100%;

// places all items within the <dd> horizontally
&:not(.singleCheckbox) {
display: flex;
flex-direction: column;
}

&.singleCheckbox {
display: grid;
grid-template-columns: min-content 1fr;

& > :not(input[type='checkbox'], label) {
grid-column: 1 / -1;
}
}
}

&.checkboxes ul, &.radios ul {
Expand Down

0 comments on commit f49f1f7

Please sign in to comment.