-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: position calculation for inline popups #1350
base: trunk
Are you sure you want to change the base?
Conversation
This was already done and reverted in #855. @dkoo, that's a tricky one that I know you've faced before. Publishers tweaked the prompt position until it was visually acceptable no matter the number, changing the logic will impact everyone regardless. I'll keep this as a draft until we figure out how to deal with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still not perfect, but it's much better. For example, with the following content I'd expect the 50% block to be inserted between the second and third List blocks, but it's actually inserted between the first and second. But I think this is definitely an improvement over what we have, and the accuracy will probably get better with longer content as well.
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>List item 1</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 1</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 2</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 3</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 4</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 5</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 6</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>List item 1</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 2</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 3</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 4</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 5</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 6</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>List item 1</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 2</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 3</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 4</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 5</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 6</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>List item 1</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 2</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 3</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 4</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 5</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>List item 6</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
Looks like there's a failing test, too—does this indicate a regression in the "single group block + 0% prompt" scenario? |
All Submissions:
Changes proposed in this Pull Request:
https://app.asana.com/0/1200550061930446/1206767149727703/f
The logic used to calculate the position for the inline popups is not the same as applied to determining the position of the blocks.
When doing it for the block positions it's ignoring the HTML for inner blocks, causing blocks like lists to be miscalculated and inline prompts using percentage positioning to appear further down than they should.
This PR introduces a
get_block_length
method to normalize how they are calculated, also fixing the issue with lists.How to test the changes in this Pull Request:
Other information: