Repository navigation
feat(text-field): add support for color input type - #124
Conversation
There was a problem hiding this comment.
📋 Review Summary
This pull request adds native HTML5 type="color" input support to the md-text-field component. It includes custom styling for color swatches across WebKit and Gecko engines, ensures appropriate label floating via the populated attribute, and updates documentation and demo files.
🔍 General Feedback
- Clean and minimal implementation for supporting native color inputs within
md-text-field. - Good handling of the
populatedstate to ensure floating labels do not overlap the native color swatch when no initial value is explicitly provided.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 35,051 |
| Input Tokens (cached) | 323,315 (⚡ 90.2% cached) |
| Output Tokens | 144 |
| Total Session Tokens | 359,891 |
| Cost (uncached input) | $0.0263 |
| Cost (cached input) | $0.0242 |
| Cost (output) | $0.0005 |
| Estimated Total Cost | $0.0511 |
Gemini 3.7 Flash: introductory rate $0.75/$3.75 per 1M applied; reverts to $1.5/$7.5 after 2026-12-31.
Gemini 3.7 Flash: standard tier; batch and flex are half again, priority is higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
material | 4abeed3 | Commit Preview URL Branch Preview URL |
Oct 04 2026, 06:31 PM |
There was a problem hiding this comment.
📋 Review Summary
This pull request adds support for HTML5 type="color" to md-text-field. It introduces tailored color swatch styling for WebKit and Gecko, floating label preservation for the non-empty color swatch, click delegation to open the native colour picker from anywhere on the field, and a standard showPicker() method. The documentation in text/README.md and the interactive showcase in demo/components/expressive-component.js have also been updated accordingly.
🔍 General Feedback
- The implementation for
type="color"is well thought out. In particular, ensuring that?populatedevaluates to true for colour inputs prevents the resting label from overlapping the colour swatch. - The addition of defensive optional chaining (
this.getInputOrTextarea()?.value) inupdated()improves resilience against lifecycle race conditions where the internal input may not yet be instantiated. - Disabling pointer events on
.input[type='color']whenreadonlyis active provides a great usability improvement, compensating for the fact that native<input type="color">ignores the HTMLreadonlyattribute.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 46,598 |
| Input Tokens (cached) | 386,641 (⚡ 89.2% cached) |
| PR Comments History Tokens | 313 |
| Thinking / Reasoning Tokens | 27,447 |
| Output Tokens | 266 |
| Total Session Tokens | 461,265 |
| Cost (uncached input) | $0.0352 |
| Cost (cached input) | $0.0290 |
| Cost (thinking / reasoning) | $0.1029 |
| Cost (response output) | $0.0010 |
| Estimated Total Cost | $0.1681 |
Gemini 3.8 Flash: introductory rate $0.75/$3.75 per 1M applied; reverts to $1.5/$7.5 after 2026-12-31.
Gemini 3.8 Flash: standard tier; batch and flex are half again, priority is higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
Description
Adds support for
type="color"on<md-text-field>.Details:
renderField()to automatically marktype === 'color'aspopulatedso floating labels float properly above the color swatch..input[type='color']and cross-browser swatch pseudo-elements (::-webkit-color-swatch,::-moz-color-swatch, and Firefox::-moz-focus-inner), with theme-aware border token fallback.showPicker()method forwarding to the input, and delegates clicks anywhere in the field container to open the picker.pointer-events: noneandcursor: defaulton disabled and readonly color fields, with disabled opacity applied.#000000on submission ([getFormValue]()) and onreset().text/README.md.Verification:
main(33 commits forward, resolved conflict indemo/index.html).#000000populatedattribute and label floatingFormData) andform.reset()showPicker()invocation on container clickdisabledandreadonlystyling / pointer-events