Skip to content

Commit 3575144

Browse files
committed
Bug 1716806 - There should be a separator space between radio buttons/checkboxes and their labels/strings
1 parent 3676ffd commit 3575144

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/core/xfa/template.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,21 @@ class Caption extends XFAObject {
12071207
return HTMLResult.EMPTY;
12081208
}
12091209

1210+
// For checkButton captions, add a non-breaking space at the beginning
1211+
// and replace all spaces with non-breaking spaces to prevent word wrapping
1212+
const parent = this[$getParent]();
1213+
if (parent?.ui?.checkButton && typeof value === "object" && value.children) {
1214+
for (const child of value.children) {
1215+
if (child.value && typeof child.value === "string") {
1216+
// Replace all regular spaces with non-breaking spaces
1217+
child.value = child.value.startsWith(" ")
1218+
? child.value.replace(/ /g, "\u00A0")
1219+
: "\u00A0" + child.value.replace(/ /g, "\u00A0");
1220+
child.value = child.value.replace(/\//g, "\u2044");
1221+
}
1222+
}
1223+
}
1224+
12101225
const savedReserve = this.reserve;
12111226
if (this.reserve <= 0) {
12121227
const { w, h } = this[$getExtra](availableSpace);

0 commit comments

Comments
 (0)