Remove clip
property by moving chosen-single’s search input.
#2939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@harvesthq/chosen-developers to fix #2816, replaces #2780.
This PR removes the deprecated
clip
property by replacing it withdisplay: none
anddisplay: block
, just as @bingxie did in #2780 — however, this PR also moves the search input when using a single-select chosen to fix focus issues.The core issue is that we were relying on the search input to catch keyboard events (including tabbing to the field), and that for single-select chosen instances, the search input was inside of the results drop that is hidden when you’re tabbing to the field.
When using
left: -9999px
, the element was still technically visible (although it wasn’t) so it could catch keyboard events. When usingclip: rect(0,0,0,0)
, it was also still technically visible (although it wasn’t).For single-select chosen instances:
opacity: 0
via CSS so it can receive keyboard events, but not adjust the design.opacity: 0
CSS rule no longer applies.opacity: 0
CSS rule applies once more./cc @Mateuspv as the original issue reporter
It looks like CI is failing to run tests because it can’t load jQuery — I checked for a quick fix but we may need to stop relying on a CDN for build stability. I’ll confirm that this is not just an issue with this PR, and then open up a new PR to fix the build. Until then, you can run the tests locally to confirm, if you’d like.