Skip to content

feat: add placeholder setting for select elements#105

Merged
liamwalder merged 4 commits intodevelopfrom
feat/select-placeholder
Mar 30, 2026
Merged

feat: add placeholder setting for select elements#105
liamwalder merged 4 commits intodevelopfrom
feat/select-placeholder

Conversation

@lunenas
Copy link
Copy Markdown
Collaborator

@lunenas lunenas commented Mar 27, 2026

Summary

Add a "Placeholder" text input to the select options settings panel that manages
a special disabled/hidden first <option> element. The default select template
now ships with a "Select an option" placeholder out of the box.

Changes

  • Add isPlaceholder flag to LayerSettings type for marking placeholder options
  • Add placeholder input to SelectOptionsSettings with add/update/remove logic
  • Update default select template to include a placeholder option
  • Strip selected attribute from <option> elements in the React canvas renderer to prevent console warnings
  • Set defaultValue="" on <select> elements with placeholder children in the canvas
  • Add selected attribute for placeholder options in SSR HTML output

Test plan

  • Add a new Select element from the elements panel — verify it shows "Select an option" placeholder by default
  • Edit the placeholder text in the Options settings — verify it updates in the canvas
  • Clear the placeholder text — verify the placeholder option is removed
  • Publish and verify the placeholder shows correctly on the live page
  • Select a different option, then check the placeholder cannot be re-selected (disabled + hidden)
  • Verify no React console warnings about selected on <option>
  • Verify collection-sourced selects still work correctly

Made with Cursor

lunenas added 3 commits March 27, 2026 10:16
Add a "Placeholder" input to the select options settings panel that
manages a special disabled/hidden first option. The default select
template now includes a "Select an option" placeholder out of the box.

Made-with: Cursor
Remove selected attribute from placeholder options to avoid React
warning. Set defaultValue="" on the select element in the canvas
renderer, and add selected in the SSR HTML output for placeholder
options.

Made-with: Cursor
React does not support the selected attribute on <option> elements.
Filter it out during attribute normalization to prevent the console
warning for all option elements, including those from existing data.

Made-with: Cursor
@lunenas lunenas self-assigned this Mar 27, 2026
@tristan-mouchet tristan-mouchet added the Improvement Improve existing feature label Mar 27, 2026
@liamwalder liamwalder merged commit 08e75c5 into develop Mar 30, 2026
2 checks passed
@liamwalder liamwalder deleted the feat/select-placeholder branch March 30, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Improve existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants