Enable Chosen initialization on mobile devices#80
Conversation
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
|
@copilot Some new jasmine failures from these new tests: |
There was a problem hiding this comment.
Pull request overview
This PR enables Chosen initialization on mobile devices by removing mobile user agent detection from the browser_is_supported() method. The change addresses a bug where dynamic selects (e.g., AJAX-populated options) couldn't function on mobile browsers because Chosen refused to initialize.
Key Changes
- Removed mobile device user agent checks from
browser_is_supported()- now only blocks IE < 8 - Added comprehensive test coverage for mobile browser support across both jQuery and Prototype versions
- Updated CHANGELOG.md to document the mobile support feature
Reviewed changes
Copilot reviewed 6 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| coffee/lib/abstract-chosen.coffee | Removed mobile device detection regex checks from browser_is_supported() static method |
| spec/jquery/mobile.spec.coffee | Added new test suite for mobile user agent support and touch interactions (jQuery) |
| spec/proto/mobile.spec.coffee | Added new test suite for mobile user agent support and initialization (Prototype) |
| docs/chosen.jquery.js | Compiled JavaScript reflecting source changes |
| docs/chosen.jquery.min.js | Minified compiled JavaScript |
| docs/chosen.proto.js | Compiled Prototype JavaScript reflecting source changes |
| docs/chosen.proto.min.js | Minified Prototype JavaScript |
| dist/js/chosen.jquery.js | Distribution copy of compiled jQuery JavaScript |
| dist/js/chosen.jquery.min.js | Distribution copy of minified jQuery JavaScript |
| dist/js/chosen.proto.js | Distribution copy of compiled Prototype JavaScript |
| dist/js/chosen.proto.min.js | Distribution copy of minified Prototype JavaScript |
| CHANGELOG.md | Added Unreleased section documenting mobile support feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ly accessible Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
... Fixed in commit 4ba5867. The tests were trying to access |
…ouch tests Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
|
@copilot 1 Jasmine failure: |
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
... Fixed in commit 940907b. The test was triggering |
Summary
Removed mobile device detection that prevented Chosen from initializing on mobile browsers. Dynamic selects (e.g., AJAX-populated options) now function correctly on mobile devices.
Changes:
coffee/lib/abstract-chosen.coffee: Removed mobile user agent checks frombrowser_is_supported(). Now only blocks IE < 8.touchstart/touchmove/touchendhandlers in both jQuery and Prototype versions.$('body').append(div)for jQuery,document.body.insert(div)for Prototype) and cleanup (div.remove()) to prevent memory leaks$.Event("mouseup", which: 1)to properly simulate selection through Chosen's event handling chainCHANGELOG.md.Please double-check that:
package.json.See the Pull Requests section of our Contributing Guidelines for more details.
References
Addresses issue requesting mobile support for dynamic select population scenarios.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.