Skip to content
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/115: overflow charmap popver #130

Merged
merged 4 commits into from
Jun 14, 2022
Merged

fix/115: overflow charmap popver #130

merged 4 commits into from
Jun 14, 2022

Conversation

Sidsector9
Copy link
Member

Description of the Change

Computes the Rect.x position depending on the editor viewport and the range selection rectangle widths.
The user experience is a bit glitchy especially when the overlap happens on the left border, however the feature is 100% usable. Once this is fixed in Gutenberg Core, we can revert this fix.

Closes #115

Screenshot

Before (left)

Screen Shot 2022-06-07 at 5 18 30 PM

Before (right)

Screen Shot 2022-06-07 at 5 18 44 PM

After (left)

Screen Shot 2022-06-07 at 5 17 58 PM

(right)

Screen Shot 2022-06-07 at 5 18 08 PM

Verification Process

Test the fix on the following themes by comparing with the screenshots above:

  • TwentyNineteen
  • TwentyTwenty
  • TwentyTwentyOne

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Fixed: inserter popup overflow which prevents user from selecting few characters.

Credits

Props @cldhmmr @Sidsector9

@Sidsector9 Sidsector9 self-assigned this Jun 7, 2022
@Sidsector9 Sidsector9 requested review from a team and peterwilsoncc and removed request for a team June 7, 2022 12:01
@jeffpaul jeffpaul added this to the 1.1.0 milestone Jun 7, 2022
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

I am seeing an issue with the top placement in Firefox 102/MacOs Big Sur.

I think the cause is that the top of the box is placed at the top of the box but I am having a little difficulty confirming it.

placement-tt1

src/index.js Outdated
@@ -46,7 +46,42 @@ registerFormatType( type, {
};
// Pin the Popover to the caret position.
const anchorRect = () => {
return getRectangleFromRange( anchorRange );
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
/*

Nitpick: Only docblocks use **, multi-line comments use a single asterisks.

Copy link
Member Author

Choose a reason for hiding this comment

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

@peterwilsoncc I made this change. Out of curiosity can you also explain on the rationale behind this?

Copy link
Contributor

Choose a reason for hiding this comment

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

can you also explain on the rationale behind this?

The short version is that it meets the WP coding standards but I can take an educated guess as to the reason behind it.

The phpdoc spec defines a docblock as starting with a double asterisks. The JSDoc spec uses the same convention.

My guess is that it helps with parsing the code files in to something more useful, such as the developer.wordpress.org pages. If a comment begins with /** then the parser knows it needs to check whether the comment is a valid docblock.

If a comment only begins with /* then the parser knows it can be skipped and considered an inline comment.

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@Sidsector9
Copy link
Member Author

@peterwilsoncc I'm unable to reproduce the issue on Firefox 101. Are you testing on Firefox 102 beta?

peterwilsoncc
peterwilsoncc previously approved these changes Jun 9, 2022
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Are you testing on Firefox 102 beta?

I was but I figured out the issue is something different.

I'd left Gutenberg 13.3.0 active and had thought I'd disabled it. The issue is not apparent in the latest version of the plugin, 13.4.0.

Placement is as expected in the following configs so I'll approve.

  • WordPress 6.0
  • WordPress 5.9
  • Both of above with Gutenberg 13.4.0

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

I've noticed 8b91edb includes a large change to package-lock.json

Was that intentional?

@Sidsector9
Copy link
Member Author

@peterwilsoncc I was confused myself as running npm i generated it. I've synced this branch with develop and removed package-lock.json.

@jeffpaul jeffpaul requested a review from peterwilsoncc June 13, 2022 17:34
@jeffpaul jeffpaul merged commit 010061d into develop Jun 14, 2022
@jeffpaul jeffpaul deleted the fix/115 branch June 14, 2022 02:00
@dkotter
Copy link
Collaborator

dkotter commented Jun 24, 2022

In prepping for a new release I was looking through why our e2e tests were failing (especially after I merged in a PR from dependabot that broke them further). We have some timeout issues we're running into but there's also an error that was introduced from this PR in our minimum environment only.

In those tests, we're getting:
Cannot read properties of null (reading 'getBoundingClientRect')

Looking at the code here, I'm assuming it's because the .interface-interface-skeleton__content element must not exist in WP 5.4 (maybe newer versions as well, not sure when that was added to WP). I believe this will break this plugin within any WP 5.4 environments and since we technically support that version, I think we need to address this before we do a release.

I think it may be as simple as checking if that element exists and if not, just return the value we were using previously. Otherwise we can run these new calculations.

Curious on other's thoughts though, /cc @Sidsector9 @jeffpaul @peterwilsoncc

@jeffpaul
Copy link
Member

@dkotter I'd also be fine bumping the WP minimum to something more current, would be curious if we're able to determine when that element exists and if setting that as a minimum would work for us.

@peterwilsoncc
Copy link
Contributor

It looks like the classes were renamed around 5.4, see WordPress/gutenberg@de7c442

@jeffpaul
Copy link
Member

In that case, I'm totally fine bumping the WP minimum to 5.4 (or frankly even up to 6.0 if that made things easier to maintain here).

@dkotter
Copy link
Collaborator

dkotter commented Jun 27, 2022

5.4 is our current minimum. In running some tests, seems the HTML changes were made in 5.5, so I've opened a PR that bumps our minimum to 5.5

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.

Inserter popup hides behind admin sidebar in themes with full-width editors
4 participants