Skip to content

Conversation

@joshuatf
Copy link
Contributor

@joshuatf joshuatf commented May 3, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

  • Fixes the toolbar positioning to right above the content editing area
  • Deselects the block on blur to remove the toolbar

Screen Shot 2023-05-02 at 4 31 01 PM

Closes #37956 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Navigate to Tools -> WCA Test Helper -> Features and enable the new product blocks editing experience
  2. Navigate to Products -> Add new
  3. Click on the summary field
  4. Note that the toolbar is now directly above the editable area and not above the label "Summary"
  5. Type some text and then attempt to use the toolbar, verifying that it works as expected
  6. Click anywhere else on the page and verify that the toolbar is no longer visible

@joshuatf joshuatf requested a review from a team May 3, 2023 00:06
@joshuatf joshuatf self-assigned this May 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Hi , @woocommerce/mothra

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Test Results Summary

Commit SHA: 2dce869

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202691m 9s
E2E Tests1870010019714m 58s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@mdperez86 mdperez86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After doing some local testing I found a rare behavior with the toolbar. Maybe that is not gonna happened to a merchant.
When testing with the DevTool opened and changing the focus between the Summary field and the DevTool window, for some reason the toolbar only shows one button item. But if we change the focus between element within the form the tool bar shows all the items in this case with a little delay between each item render.

Screen.Recording.2023-05-03.at.12.12.48.PM.mov

style: { direction },
} );
const id = uniqueId();
const contentId = uniqueId(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there are future plans to remove lodash from WP and given that there is a similar function then we should use import { useInstanceId } from '@wordpress/compose'; instead as the standard right!?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! Updated in 2dce869.

dir={ direction }
allowedFormats={ allowedFormats }
/>
<div { ...blockProps }>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that moving this from the top most element is not gonna cause any rare behavior in the future?
I'm just curious about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering the same. It might cause some issues in the future, but it's pretty easy to revert if that happens.

If that turns out to be the case, we may try creating a class in the editor root to determine current block selection and position the toolbar accordingly. This is not an ideal solution, but currently there is no way to pass any props to the toolbar popover.

@joshuatf
Copy link
Contributor Author

joshuatf commented May 4, 2023

When testing with the DevTool opened and changing the focus between the Summary field and the DevTool window, for some reason the toolbar only shows one button item. But if we change the focus between element within the form the tool bar shows all the items in this case with a little delay between each item render.

I'm able to see this too and believe it's related to Gutenberg behavior around selecting the parent block. This is also visible on trunk when clicking the "Summary" label instead of the textarea.

Screen Shot 2023-05-04 at 4 55 04 PM

Since this is pretty hard to reproduce on this branch without having dev tools open and is easily resolved by selecting text you want to modify, I'm okay to leave this as is unless you think it's a priority.

Copy link
Contributor

@mdperez86 mdperez86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!!! @joshuatf nice job

@joshuatf joshuatf merged commit f1db682 into trunk May 5, 2023
@joshuatf joshuatf deleted the fix/37956 branch May 5, 2023 18:52
@github-actions github-actions bot added this to the 7.8.0 milestone May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Product Block Editor: Summary edit toolbars issues ( displayed to high, and not hiding on blur )

3 participants