Editor icon fields: HA icon-picker dropdown with native fallback — v0.16.5 - #32
Merged
Merged
Conversation
The shared _tf() editor helper built text/number fields with `ha-textfield`. That Home Assistant element isn't guaranteed to be registered in every frontend build; when it's missing it renders as an empty invisible custom element, so every text field silently vanished from the visual editors — Title, Name, Icon, Unit, Decimals, Bar max, Energy label, History window. The controls that still showed use ha-entity-picker, native <select>, and ha-switch, which were loaded. Rewrite _tf() to render a native <input class="tf"> inside a labelled .field wrapper, matching the native <select class="sel"> already used for dropdowns. Same API (type, suffix); add .tf/.tf-row/.tf-suffix styles; drop the obsolete ha-textfield style rule. Fixes invisible text fields across every Prism card editor, not just the power card. Verified in Chromium with ha-textfield deliberately undefined: all fields now render and editing the title fires config-changed. VERSION 0.16.3 -> 0.16.4. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014cpNPVU8j1iiU9CnXgr5JY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The visual editors now use Home Assistant's searchable icon picker (
ha-icon-picker) for the "Icon" field instead of a plain text input.A new shared
_iconField()helper onPrismEditorrendersha-icon-pickerwhen that element is registered in the frontend, and falls back to the native text input otherwise — the same defensive pattern as the v0.16.4ha-textfieldfix, since a missing custom element renders as an invisible node.set hass/_rerendernow also propagatehasstoha-icon-picker.The seven icon fields — stat, power, cover, linear-gauge, switch, light cards, plus the entities-card row editor — now use it. The
iconconfig key and card rendering are unchanged.Testing
Verified in Chromium both ways:
ha-icon-pickerdefined → the dropdown is used; pickingmdi:homefiresconfig-changedwith the new icon.ha-icon-pickerundefined → falls back to the nativeIcon (mdi:…)input; no errors.bash build.sh+node test/smoke.jsgreen.VERSION 0.16.4 → 0.16.5.
🤖 Generated with Claude Code
Generated by Claude Code