Skip to content

pat-select2 native input/change/blur events#1598

Merged
thet merged 2 commits into
masterfrom
thet/select2-native-events
Jun 5, 2026
Merged

pat-select2 native input/change/blur events#1598
thet merged 2 commits into
masterfrom
thet/select2-native-events

Conversation

@thet
Copy link
Copy Markdown
Member

@thet thet commented Jun 5, 2026

Align with @patternslib/patternslib pat-auto-suggest and throw native input, change and blur events on the original input element when Select2 throws it's jQuery equivalents.

This allows the upcoming @patternslib/patternslib pat-bind pattern to get active when a select2 change has happened: Patternslib/Patterns#1288

This is also some cleanup before pat-select2 gets replaced by some other, leaner, non-jQuery based select enhancement library.

  • I signed and returned the Plone Contributor Agreement, and received and accepted an invitation to join a team in the Plone GitHub organization.
  • I verified there aren't any other open pull requests for the same change.
  • I followed the guidelines in Contributing to Plone.
  • I successfully ran code quality checks on my changes locally.
  • I successfully ran tests on my changes locally.
  • If needed, I added new tests for my changes.
  • If needed, I added documentation for my changes.
  • I included a change log entry in my commits.

If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.

Closes #

When a selection change was done in pat-select2, the Select2 library was
only firing a jQuery change event which was never caught by native
JavaScript event handlers. This is now fixed - on a Select2 change event
a native JavaScript input event is fired. The input event is used as it
is the better choice. The native change event has some limitations and
is historically not fired on each value change.

This aligns the behavior to pat-auto-suggest from @patternslib/patternslib.
@thet thet requested review from MrTango and petschki June 5, 2026 09:42
When Select2 looses focus a jQuery blur event is thrown. This is not
catched by native JavaScript event handler. This is now fixed - a
Select2 blur event also throws a native blur event on the original input
or select element.

This aligns the behavior to pat-auto-suggest from @patternslib/patternslib.
@thet thet force-pushed the thet/select2-native-events branch from 8571ffe to 3290a6f Compare June 5, 2026 09:44
Copy link
Copy Markdown
Contributor

@MrTango MrTango left a comment

Choose a reason for hiding this comment

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

LGTM

@thet thet merged commit d777ea8 into master Jun 5, 2026
3 checks passed
@thet thet deleted the thet/select2-native-events branch June 5, 2026 11:05
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.

2 participants