Skip to content

Fix radio field crash with nested option strings#12345

Merged
tyrasd merged 1 commit into
openstreetmap:developfrom
FloEdelmann:fix/radio-stringsCrossReference-title
May 18, 2026
Merged

Fix radio field crash with nested option strings#12345
tyrasd merged 1 commit into
openstreetmap:developfrom
FloEdelmann:fix/radio-stringsCrossReference-title

Conversation

@FloEdelmann
Copy link
Copy Markdown
Contributor

When a radio field uses stringsCrossReference to reference another field whose option strings are structured as { title, description } objects (rather than flat strings), rendering the field throws:

TypeError: callback.apply is not a function

This happens because tInfo returns the raw { title, description } object in texts, and t.append then calls selection.call(object) — but D3's selection.call() expects a function.

The combo field already handles this correctly via its getLabelId helper, which checks for a .title sub-key first. The radio field was missing equivalent logic.

This issue was exposed by openstreetmap/id-tagging-schema#2268, which changes the parking_entrance field from type combo to type radio. The parking field it references via stringsCrossReference uses nested { title, description } option strings.

@FloEdelmann
Copy link
Copy Markdown
Contributor Author

FloEdelmann commented May 15, 2026

Yay, issue #12345 🥳 😄

@tordans
Copy link
Copy Markdown
Collaborator

tordans commented May 15, 2026

This will not happen anymore after ideditor/schema-builder#281, right?

@tyrasd tyrasd added the bug A bug - let's fix this! label May 18, 2026
@tyrasd
Copy link
Copy Markdown
Member

tyrasd commented May 18, 2026

This will not happen anymore after ideditor/schema-builder#281, right?

No, this fix is still relevant also when we have pre-resolved strings: If a radio field references strings from a combo field with "nested" strings (i.e. separate title and description properties), the radio field still needs to explicitly choose the .title string instead of the simple "non-nested" string that radio fields usually have.

tyrasd added a commit to ideditor/schema-builder that referenced this pull request May 18, 2026
@tyrasd tyrasd merged commit f95ba42 into openstreetmap:develop May 18, 2026
3 checks passed
@FloEdelmann FloEdelmann deleted the fix/radio-stringsCrossReference-title branch May 18, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A bug - let's fix this!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants