You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have have carried out troubleshooting steps and I believe I have found a bug.
I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
Describe the bug
When the admin-bar is displayed on the front-end of WordPress, the html element has margin-top, and the select2 dropdown is positioned incorrectly.
I think this is caused by the use of the jQuery function .offset() which does not include the html element's margin. This is noted in the jQuery documentation: https://api.jquery.com/offset/
jQuery does not support getting the offset coordinates of hidden elements or accounting for margins set on the <html> document element.
Expected behavior
I expect to see the current selection above the dropdown while the dropdown is open.
Actual behavior
The current selection is covered by the dropdown only when the WordPress admin-bar is shown.
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.)
Steps to reproduce the bug:
Log in to WordPress / WooCommerce
Try to add an address, either in Checkout or My Account.
Screenshots
Logged In
Logged Out
Isolating the problem (mark completed items with an [x]):
I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
This bug happens with a default WordPress theme active, or Storefront.
I can reproduce this bug consistently using the steps above.
Fixes I've Tried
I fixed this in my own theme styles by adding margin-top to .select2-dropdown that corresponds to the admin-bar height.
We are also running into this and it broke our selectWoo usage as well. Seems new in a recent update: either WooCommerce or Wordpress 5.7, but I haven't confirmed exact one; just know that it broke recently.
I have come across the same issue on some pages in WordPress v6.0.1 and WooCommerce 6.8.0.
There is no longer "admin-bar" class added to BODY when the admin bar appears, so the above styles don't help!
select2.full.js?ver=4.0.3-wc.6.8.0 does NOT contain the attachBody fixes from https://github.com/woocommerce/selectWoo/pull/49/files
Applying these 2 changes fixes the issue.
Prerequisites (mark completed items with an [x]):
Describe the bug
When the admin-bar is displayed on the front-end of WordPress, the html element has margin-top, and the select2 dropdown is positioned incorrectly.
I think this is caused by the use of the jQuery function .offset() which does not include the html element's margin. This is noted in the jQuery documentation: https://api.jquery.com/offset/
Expected behavior
I expect to see the current selection above the dropdown while the dropdown is open.
Actual behavior
The current selection is covered by the dropdown only when the WordPress admin-bar is shown.
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.)
Steps to reproduce the bug:
Screenshots
Logged In
Logged Out
Isolating the problem (mark completed items with an [x]):
Fixes I've Tried
I fixed this in my own theme styles by adding margin-top to
.select2-dropdown
that corresponds to the admin-bar height.The text was updated successfully, but these errors were encountered: