Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/form-listbox-rendering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@embedpdf/plugin-form': patch
---

Fix list box form widgets rendering unusably when the option count exceeds the widget height. Option rows now carry `flexShrink: 0`, so they keep their natural line height and the container scrolls instead of the flex column crushing all rows into the box. The overlay background now treats a missing or `transparent` annotation color as opaque white, so the widget's appearance-stream image no longer shows through and doubles the option text. Applied to both the interactive form-fill list box and the annotation-mode renderer.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export function FormListbox({ annotation, isSelected, scale, onClick, style }: F
style={{
position: 'absolute',
inset: 0,
background: object.color ?? '#FFFFFF',
// The overlay redraws the option list itself, so it must fully cover the
// appearance-stream image behind it — treat 'transparent' as opaque white.
background: !object.color || object.color === 'transparent' ? '#FFFFFF' : object.color,
border: `${borderWidth}px solid ${object.strokeColor ?? '#000000'}`,
outline: isHovered || isSelected ? '1px solid rgba(66, 133, 244, 0.5)' : 'none',
outlineOffset: -1,
Expand All @@ -50,6 +52,7 @@ export function FormListbox({ annotation, isSelected, scale, onClick, style }: F
<div
key={i}
style={{
flexShrink: 0,
padding: `0 ${4 * scale}px`,
fontSize,
lineHeight: `${lineHeight}px`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function ListboxField(props: ListboxFieldProps) {
left: 0,
width: '100%',
height: '100%',
background: annotation.color ?? '#FFFFFF',
// The overlay redraws the option list itself, so it must fully cover the
// appearance-stream image behind it — treat 'transparent' as opaque white.
background:
!annotation.color || annotation.color === 'transparent' ? '#FFFFFF' : annotation.color,
borderStyle: 'solid',
borderColor: annotation.strokeColor ?? '#000000',
borderWidth: bw,
Expand Down Expand Up @@ -63,6 +66,7 @@ export function ListboxField(props: ListboxFieldProps) {
key={i}
onClick={() => handleOptionClick(i)}
style={{
flexShrink: 0,
padding: `0 ${4 * scale}px`,
fontSize,
lineHeight: `${lineHeight}px`,
Expand Down