Skip to content

Commit 52b9dc7

Browse files
millusclaude
andcommitted
fix: address Input component review feedback
- Remove incorrect placeholder color override in readonly state (lines 102-106) This was creating a CSS variable scoping issue where placeholder used the default color instead of readonly color - Add test for readonly + invalid showing neutral appearance - Add test for error icon hidden in readonly + invalid state Addresses review feedback on PR #4531 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 737c27b commit 52b9dc7

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

packages/eds-core-react/src/components/next/Input/Input.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ describe('Input (Next EDS 2.0)', () => {
127127
const errorIcon = container.querySelector('.eds-error-icon')
128128
expect(errorIcon).not.toBeInTheDocument()
129129
})
130+
131+
it('Does not show error icon when readOnly even if invalid', () => {
132+
const { container } = render(
133+
<Input invalid readOnly aria-label="ReadOnly invalid input" />,
134+
)
135+
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
136+
const errorIcon = container.querySelector('.eds-error-icon')
137+
expect(errorIcon).not.toBeInTheDocument()
138+
})
130139
})
131140

132141
describe('Adornments', () => {
@@ -208,6 +217,12 @@ describe('Input (Next EDS 2.0)', () => {
208217
expect(wrapper).toHaveAttribute('data-color-appearance', 'neutral')
209218
})
210219

220+
it('Sets neutral appearance when readOnly regardless of invalid state', () => {
221+
render(<Input invalid readOnly />)
222+
const wrapper = getInputWrapper()
223+
expect(wrapper).toHaveAttribute('data-color-appearance', 'neutral')
224+
})
225+
211226
it('Input element has correct font styling attributes', () => {
212227
render(<Input invalid value="test" readOnly />)
213228
const input = screen.getByDisplayValue('test')

packages/eds-core-react/src/components/next/Input/input.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@
9898
color: var(--_readonly-text-color);
9999
/* Safari autofill override */
100100
-webkit-text-fill-color: var(--_readonly-text-color);
101-
102-
&::placeholder {
103-
color: var(--_placeholder-text-color);
104-
/* Safari autofill override */
105-
-webkit-text-fill-color: var(--_placeholder-text-color);
106-
}
107101
}
108102

109103
& .eds-adornment__text,

0 commit comments

Comments
 (0)