acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
238 stars 27 forks source link

User is scrolled to incorrect position when editing nested flexible content fields in modal #87

Closed bekahmcdonald closed 1 year ago

bekahmcdonald commented 2 years ago

Description

When you have a flexible content field inside another flexible content field, and you're using modals, the user gets scrolled to the wrong position when adding a new row to the nested flexible content field.

The problem seems to be caused in these lines of code in acfe-input.min.js – the user gets scrolled to the top of the outer flexible content field which is disorientating (see attached gif)

$modal.find('> .acfe-modal-wrapper > .acfe-modal-content').animate({
   scrollTop: parseInt($el.offset().top) - 200
}, 200);

To reproduce

Create a field group, which is set to open in a modal. Inside the fieldgroup, create a flexible content field. Add a layout to that field, and give the layout a flexible content field. Add the fieldgroup to a post or page.

Edit the post/page, and try to add a row to the nested flexible content field, and watch the scroll position.

Expected behavior

User should be scrolled to the top of the new row they just added

Screenshots

ACFE scroll issue

WordPress & ACF

WordPress version: 5.8.1 ACF Pro version: 5.10.2 ACF add-ons: N/A

acf-extended commented 1 year ago

Hello,

Thanks for the feedback!

This issue have been fixed in the ACF Extended 0.8.8.11 update, with the rework of the modal logic.

Have a nice day!

Regards.