Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(frontend-components): announce stored secret guidance

Josuéf8bf83dbbaf9
diff --git a/packages/frontend-components/src/edit/SecretEditField.tsx b/packages/frontend-components/src/edit/SecretEditField.tsx
index 52993b480..0dbd9e40a 100644
--- a/packages/frontend-components/src/edit/SecretEditField.tsx
+++ b/packages/frontend-components/src/edit/SecretEditField.tsx
@@ -15,7 +15,16 @@ export function SecretEditField({
clearLabel = 'Clear value',
restoreLabel = 'Restore',
}: SecretEditFieldProps) {
+ const storedHintId = `${id}-stored-hint`
+ const helpTextId = `${id}-help`
const inputValue = state.status === 'replaced' ? state.value : ''
+ const describedBy =
+ [
+ existingValue && state.status === 'untouched' ? storedHintId : undefined,
+ helpText ? helpTextId : undefined,
+ ]
+ .filter(Boolean)
+ .join(' ') || undefined
function change(event: ChangeEvent<HTMLInputElement>) {
const next = event.currentTarget.value
onStateChange(
@@ -35,6 +44,7 @@ export function SecretEditField({
<input
autoComplete="new-password"
className="eft-secret-field__input"
+ aria-describedby={describedBy}
disabled={disabled}
id={id}
onChange={change}
@@ -43,11 +53,15 @@ export function SecretEditField({
value={inputValue}
/>
{existingValue && state.status === 'untouched' ? (
- <p className="eft-secret-field__hint" id={`${id}-stored-hint`}>
+ <p className="eft-secret-field__hint" id={storedHintId}>
A value is stored. Leave this field blank to keep it.
</p>
) : null}
- {helpText ? <div className="eft-secret-field__hint">{helpText}</div> : null}
+ {helpText ? (
+ <div className="eft-secret-field__hint" id={helpTextId}>
+ {helpText}
+ </div>
+ ) : null}
<div className="eft-secret-field__actions">
<button
className="eft-dialog__text-button"
diff --git a/packages/frontend-components/src/edit/__tests__/EditPrimitives.test.tsx b/packages/frontend-components/src/edit/__tests__/EditPrimitives.test.tsx
index 27931384f..25c41109a 100644
--- a/packages/frontend-components/src/edit/__tests__/EditPrimitives.test.tsx
+++ b/packages/frontend-components/src/edit/__tests__/EditPrimitives.test.tsx
@@ -161,6 +161,9 @@ describe('SecretEditField', () => {
const field = screen.getByLabelText('Credential')
expect(field).toHaveAttribute('type', 'password')
expect(field).toHaveValue('')
+ expect(field).toHaveAccessibleDescription(
+ 'A value is stored. Leave this field blank to keep it.'
+ )
expect(
screen.getByText('A value is stored. Leave this field blank to keep it.')
).toBeInTheDocument()