Skip to content

Assign IDs to generated search fields - #6473

Open
samipuro wants to merge 2 commits into
select2:developfrom
samipuro:fix/search-field-ids
Open

samipuro wants to merge 2 commits into
select2:developfrom
samipuro:fix/search-field-ids

Conversation

@samipuro

Copy link
Copy Markdown

Select2's generated search fields have neither an ID nor a name, causing Chrome DevTools to report a form-field warning.

Assign distinct IDs to the inline and dropdown search fields using the existing Select2 instance ID. Keep the fields unnamed so they do not add values to submitted form data.

Add regression coverage for IDs across multiple single/multiple controls, cleanup on destroy, and stable IDs without duplicates after reinitialization.

Fixes #6472.

Validation:

  • Confirmed the new regression assertions fail against unmodified source and pass with the fix.
  • All eight existing unit/integration QUnit pages passed against the raw AMD source using a temporary RequireJS loader in headless Chrome: 2,228 assertions across jQuery 1.12.4, 2.2.4, 3.7.1, and 4.0.0.
  • Grunt lint passed for all 107 source files and 42 test files.
  • JavaScript syntax checks and git diff --check passed.

Distribution files were not rebuilt or changed.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search field has neither id nor name, Chrome reports "A form field element should have an id or name attribute"

1 participant