Skip to content

fix(renderers): normalize DateTimeInput placeholder color#1029

Open
ppazosp wants to merge 2 commits intogoogle:mainfrom
ppazosp:fix/792-datetime-placeholder-color
Open

fix(renderers): normalize DateTimeInput placeholder color#1029
ppazosp wants to merge 2 commits intogoogle:mainfrom
ppazosp:fix/792-datetime-placeholder-color

Conversation

@ppazosp
Copy link
Copy Markdown

@ppazosp ppazosp commented Mar 29, 2026

Description

Normalizes placeholder text color for DateTimeInput across all three renderers (Lit, React, Angular) and both protocol versions (v0.8, v0.9).

Adds color: #333 on the input element and ::-webkit-datetime-edit / ::-webkit-datetime-edit-fields-wrapper pseudo-element selectors to ensure consistent rendering between type="date" and type="time" in Safari/WebKit.

React v0.9 uses a scoped <style> tag via React.useId() since inline styles cannot target pseudo-elements.

Fixes #792

Pre-launch Checklist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request standardizes the text color for date-time inputs across Angular, Lit, and React renderers by setting color: #333 for input elements and their WebKit-specific pseudo-elements. The review feedback focuses on improving maintainability by combining CSS rules and utilizing CSS custom properties to avoid hardcoding the color value multiple times across the different components.

Comment on lines +44 to +50
input {
color: #333;
}
input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid repetition and improve maintainability, you can combine these CSS rules since they share the same declaration.

Suggested change
input {
color: #333;
}
input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
input,
input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, combined selectors in 811f6da.

Comment on lines 81 to 86
color: #333;
}
.a2ui-date-time-input::-webkit-datetime-edit,
.a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The color #333 is duplicated. To improve maintainability, consider defining a CSS custom property on a parent element (e.g., .a2ui-date-time-container) and reusing it.

For example:

.a2ui-date-time-container {
  --placeholder-color: #333;
  /* ... other styles */
}

.a2ui-date-time-input {
  /* ... other styles */
  color: var(--placeholder-color);
}

.a2ui-date-time-input::-webkit-datetime-edit,
.a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {
  color: var(--placeholder-color);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a CSS custom property is overkill here since it's a single value in a small block. The combined selectors already reduce the duplication.

Comment on lines 60 to 66
color: #333;
}

input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The color #333 is duplicated. To improve maintainability, consider defining a CSS custom property on :host and reusing it.

For example:

:host {
  --placeholder-color: #333;
  /* ... other styles */
}

input {
  /* ... other styles */
  color: var(--placeholder-color);
}

input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
  color: var(--placeholder-color);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reasoning as above - combined selectors address the duplication without introducing a custom property for a single value.

Comment on lines +30 to +39
static styles = css`
input {
color: #333;
}

input::-webkit-datetime-edit,
input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid repetition and improve maintainability, you can combine these CSS rules since they share the same declaration.

  static styles = css`
    input,
    input::-webkit-datetime-edit,
    input::-webkit-datetime-edit-fields-wrapper {
      color: #333;
    }
  `;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, combined selectors in 811f6da.

Comment on lines 295 to 300
color: #333;
}
:where(.a2ui-surface .a2ui-datetime-input) input::-webkit-datetime-edit,
:where(.a2ui-surface .a2ui-datetime-input) input::-webkit-datetime-edit-fields-wrapper {
color: #333;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The color #333 is duplicated. To improve maintainability, consider defining a CSS custom property on a parent selector (e.g., .a2ui-surface .a2ui-datetime-input) and reusing it.

For example:

.a2ui-surface .a2ui-datetime-input {
  --placeholder-color: #333;
  /* ... other styles */
}

:where(.a2ui-surface .a2ui-datetime-input) input {
  /* ... other styles */
  color: var(--placeholder-color);
}

:where(.a2ui-surface .a2ui-datetime-input) input::-webkit-datetime-edit,
:where(.a2ui-surface .a2ui-datetime-input) input::-webkit-datetime-edit-fields-wrapper {
  color: var(--placeholder-color);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above - combined selectors reduce repetition, custom property not needed for a single value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

DateTimeInput: placeholder color differs between date and time input types

1 participant