Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function SearchableList({
aria-controls={listboxId}
aria-activedescendant={activeDescendantId}
aria-autocomplete="list"
autoComplete="off"
className="block w-full rounded-md border-secondary-300
pl-10 pr-10 shadow-xs sm:text-sm
focus:border-primary-300 focus:ring
Expand Down
1 change: 1 addition & 0 deletions assets/js/collaborative-editor/components/SessionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export function SessionList({
value={searchQuery}
onChange={e => setSearchQuery(e.target.value)}
placeholder="Search conversations..."
autoComplete="off"
className={cn(
'w-full h-[34px] pl-9 pr-3 text-sm',
'bg-gray-50 border border-gray-200 rounded-lg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export function VersionPicker({
role="combobox"
aria-expanded={isOpen}
aria-controls="version-listbox"
autoComplete="off"
/>
<button
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function NumberField({
disabled={disabled}
min={min}
max={max}
autoComplete="off"
className={INPUT_CLASSES}
/>
</FormField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function TextField({
onChange={e => field.handleChange(e.target.value)}
disabled={disabled}
placeholder={placeholder}
autoComplete="off"
className={INPUT_CLASSES}
/>
</FormField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ export function CronFieldBuilder({
<input
id="cron-expression"
type="text"
autoComplete="off"
value={value}
onChange={e => {
onChange(e.target.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
value={webhookUrl}
readOnly
disabled
autoComplete="off"
className="block w-full flex-1 rounded-l-lg
text-slate-900 disabled:bg-gray-50
disabled:text-gray-500 border border-r-0
Expand Down Expand Up @@ -582,6 +583,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
onChange={e => field.handleChange(e.target.value)}
onBlur={field.handleBlur}
disabled={isReadOnly}
autoComplete="off"
placeholder="localhost:9092, broker2:9092"
className={`
block w-full px-3 py-2 border rounded-md text-sm
Expand Down Expand Up @@ -626,6 +628,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
onChange={e => field.handleChange(e.target.value)}
onBlur={field.handleBlur}
disabled={isReadOnly}
autoComplete="off"
placeholder="topic1, topic2, topic3"
className={`
block w-full px-3 py-2 border rounded-md text-sm
Expand Down Expand Up @@ -769,6 +772,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
}
onBlur={field.handleBlur}
disabled={isReadOnly}
autoComplete="off"
className={`
block w-full px-3 py-2 border rounded-md text-sm
${
Expand Down Expand Up @@ -811,6 +815,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
}
onBlur={field.handleBlur}
disabled={isReadOnly}
autoComplete="off"
className={`
block w-full px-3 py-2 border rounded-md text-sm
${
Expand Down Expand Up @@ -928,6 +933,7 @@ export function TriggerForm({ trigger }: TriggerFormProps) {
}
onBlur={field.handleBlur}
disabled={isReadOnly}
autoComplete="off"
className={`
block w-full px-3 py-2 border rounded-md text-sm
${
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function TemplateSearchInput({
onChange={handleChange}
onKeyDown={handleKeyDown}
placeholder={placeholder}
autoComplete="off"
className={cn(
'block w-full pl-10 pr-10 py-2 border border-gray-300 rounded-lg',
'text-sm placeholder-gray-400',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function SelectedDataclipView({
<input
type="text"
value={editedName}
autoComplete="off"
onChange={e => setEditedName(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter' && !isSaving) {
Expand Down
3 changes: 3 additions & 0 deletions assets/js/manual-run-panel/views/ExistingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ExistingView: React.FC<ExistingViewProps> = ({
setQuery(e.target.value);
}}
type="text"
autoComplete="off"
className="focus:outline focus:outline-2 focus:-outline-offset-2 focus:ring-0 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 border-slate-300 focus:border-slate-400 focus:outline-indigo-600 block w-full rounded-l-md border-0 border-r-0 py-1.5 pl-10 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
placeholder="Search names or UUID prefixes"
/>
Expand Down Expand Up @@ -164,6 +165,7 @@ const ExistingView: React.FC<ExistingViewProps> = ({
<input
value={selectedDates.after}
id="created-after"
autoComplete="off"
onChange={e => {
setSelectedDates(p => ({
after: e.target.value,
Expand All @@ -179,6 +181,7 @@ const ExistingView: React.FC<ExistingViewProps> = ({
<input
value={selectedDates.before}
id="created-before"
autoComplete="off"
onChange={e => {
setSelectedDates(p => ({
after: p.after,
Expand Down
1 change: 0 additions & 1 deletion assets/js/project-picker/ProjectPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ export function ProjectPicker(props: ProjectPickerProps) {
role="combobox"
aria-controls="project-picker-options"
aria-expanded="true"
autoComplete="off"
/>
<kbd className="hidden sm:inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-gray-400 ring-1 ring-gray-300">
<span>{isMac ? '⌘' : 'Ctrl'}</span>
Expand Down
1 change: 1 addition & 0 deletions assets/js/workflow-diagram/nodes/PlaceholderJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const PlaceholderJobNode = ({ id, data, selected }: NodeProps<NodeData>) => {
inputRef?.focus();
}}
autoFocus
autoComplete="off"
value={jobName}
onChange={e => {
setJobName(e.target.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ describe('NumberField', () => {
);
}

it('renders with label and help text', () => {
it('renders with label, help text, and autoComplete="off"', () => {
render(<TestForm />);

expect(screen.getByLabelText('Count')).toBeInTheDocument();
const input = screen.getByLabelText('Count') as HTMLInputElement;
expect(input).toBeInTheDocument();
expect(screen.getByText('Enter a number')).toBeInTheDocument();
expect(input).toHaveAttribute('autocomplete', 'off');
});

it('shows placeholder when value is null', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { render, screen } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { useAppForm } from '../../../../js/collaborative-editor/components/form';
import * as useWorkflowModule from '../../../../js/collaborative-editor/hooks/useWorkflow';

// Mock useWorkflowState and useWorkflowActions (required by useAppForm's
// useValidation hook, which reads from the collaborative workflow store)
vi.mock('../../../../js/collaborative-editor/hooks/useWorkflow', () => ({
useWorkflowState: vi.fn(),
useWorkflowActions: vi.fn(() => ({
setClientErrors: vi.fn(),
})),
}));

describe('TextField', () => {
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(useWorkflowModule.useWorkflowState).mockImplementation(
(selector?: (state: any) => any) => {
const state = {
workflow: { id: 'w-1', errors: {} },
jobs: [],
triggers: [],
edges: [],
};
return selector ? selector(state) : state;
}
);
});

function TestForm({ defaultValue = '' }: { defaultValue?: string }) {
const form = useAppForm({
defaultValues: { name: defaultValue },
});

return (
<form.AppField name="name">
{field => <field.TextField label="Name" placeholder="Enter a name" />}
</form.AppField>
);
}

it('renders with label, placeholder, and autoComplete="off"', () => {
render(<TestForm />);

const input = screen.getByLabelText('Name') as HTMLInputElement;
expect(input).toBeInTheDocument();
expect(input.placeholder).toBe('Enter a name');
expect(input).toHaveAttribute('autocomplete', 'off');
});

it('displays initial value', () => {
render(<TestForm defaultValue="hello" />);

const input = screen.getByLabelText('Name') as HTMLInputElement;
expect(input.value).toBe('hello');
});
});
15 changes: 12 additions & 3 deletions lib/lightning_web/components/new_inputs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ defmodule LightningWeb.Components.NewInputs do

attr :placeholder, :string, default: ""

attr :autocomplete, :string, default: "off"

attr :rest, :global,
include:
~w(accept autocomplete capture cols disabled form list max maxlength min minlength
~w(accept capture cols disabled form list max maxlength min minlength
multiple pattern placeholder readonly required rows size step)

attr :class, :string, default: ""
Expand Down Expand Up @@ -635,6 +637,7 @@ defmodule LightningWeb.Components.NewInputs do
id={@id}
name={@name}
class={["rounded-md w-full font-mono bg-slate-800 text-slate-100", @class]}
autocomplete={@autocomplete}
value={@value}
placeholder={@placeholder}
errors={@errors}
Expand All @@ -660,6 +663,7 @@ defmodule LightningWeb.Components.NewInputs do
</.label>
<div class="relative mt-2 rounded-lg shadow-xs">
<input
autocomplete={@autocomplete}
type={@type}
name={@name}
id={@id}
Expand Down Expand Up @@ -985,6 +989,7 @@ defmodule LightningWeb.Components.NewInputs do
name={@name}
id={@id}
class={@class}
autocomplete={@autocomplete}
value={Form.normalize_value(@type, @value)}
placeholder={@placeholder}
{@rest}
Expand Down Expand Up @@ -1019,15 +1024,17 @@ defmodule LightningWeb.Components.NewInputs do
attr :value, :any
attr :errors, :list, default: []
attr :class, :string, default: ""
attr :autocomplete, :string, default: "off"

attr :rest, :global,
include:
~w(accept autocomplete capture cols disabled form list max maxlength min minlength
~w(accept capture cols disabled form list max maxlength min minlength
multiple pattern placeholder readonly required rows size step)

def input_element(assigns) do
~H"""
<input
autocomplete={@autocomplete}
type={@type}
name={@name}
id={@id}
Expand Down Expand Up @@ -1060,15 +1067,17 @@ defmodule LightningWeb.Components.NewInputs do
attr :value, :any
attr :errors, :list, default: []
attr :class, :any, default: ""
attr :autocomplete, :string, default: "off"

attr :rest, :global,
include:
~w(accept autocomplete capture cols disabled form list max maxlength min minlength
~w(accept capture cols disabled form list max maxlength min minlength
multiple pattern placeholder readonly required rows size step)

def textarea_element(assigns) do
~H"""
<textarea
autocomplete={@autocomplete}
id={@id}
name={@name}
class={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,24 @@
field={f[:first_name]}
label="First Name"
required={true}
autocomplete="given-name"
/>
</div>
<div>
<.input field={f[:last_name]} required={true} label="Last Name" />
<.input
field={f[:last_name]}
required={true}
label="Last Name"
autocomplete="family-name"
/>
</div>
<div>
<.input
field={f[:email]}
type="email"
label="Email"
required={true}
autocomplete="email"
/>
</div>
<div>
Expand All @@ -51,6 +58,7 @@
type="password"
label="Password"
required={true}
autocomplete="new-password"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
<div class="grid grid-flow-row gap-4 auto-rows-max">
<div>
<.label for={:password}>New password</.label>
<.input type="password" field={f[:password]} required />
<.input
type="password"
field={f[:password]}
required
autocomplete="new-password"
/>
</div>

<div>
Expand All @@ -38,6 +43,7 @@
type="password"
field={f[:password_confirmation]}
required
autocomplete="new-password"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@
field={f[:email]}
required={true}
label="Email"
autocomplete="email"
/>
</div>
<div>
<.input type="password" field={f[:password]} label="Password" />
<.input
type="password"
field={f[:password]}
label="Password"
autocomplete="current-password"
/>
</div>
<.check_box form={f} field={:remember_me}>
<br />
Expand Down
2 changes: 1 addition & 1 deletion lib/lightning_web/controllers/user_totp_html/new.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
type="text"
field={f[:code]}
required="true"
autocomplete="off"
autocomplete="one-time-code"
inputmode="numeric"
placeholder="XXXXXX"
class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
Expand Down
Loading