gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Link dialog jumps when changing formatting while it's open.

Open peterwilsoncc opened this issue 5 years ago • 3 comments

Description

If the link dialog is open, changing the format of the highlighted word can cause the link dialog to move on the screen. I'm able to reproduce this in both Safari and Firefox.

This was originally reported on WordPress trac by Wordpress.org user bjornsennbrink.

Step-by-step reproduction instructions

  1. Set your desktop browser with to around 1327px wide
  2. Go to the edit post screen
  3. Enter some text
  4. Highlight a word you wish to link
  5. Click the link button in the toolbar
  6. Press CMD+B on your keyboard
  7. The link dialog jumps on the screen.

On the original report, it was jumping each time the user pressed cmd+b but I've only been able to reproduce it jumping once. This is possibly worth testing at additional browser widths.

Expected behaviour

Highlighted text to bold, the dialogs position is unaffected.

Actual behaviour

Highlighted text does bold, the dialog jumps.

Screenshots or screen recording (optional)

Safari 14.0.3 safari

Firefox Developer Edition 88.0b9 firefox

Code snippet (optional)

WordPress information

  • WordPress version: Trunk (5.8-alpha-50427-src)
  • Gutenberg version: WP version, plugin not activated.
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

  • Device: Desktop
  • Operating system: macOS Big Sur 11.2.3
  • Browser: Safari 14.0.3, Firefox Developer Edition 88.0b9

peterwilsoncc avatar Apr 20 '21 23:04 peterwilsoncc

I can reproduce with Gutenberg from trunk and Chrome 89 on macOS 10.12. I've seen a similar thing elsewhere. It seems likely to be rooted in the Popover component.

stokesman avatar Apr 21 '21 05:04 stokesman

What i found so far is that sometimes the calculated clientRect of the anchorRef always delivers false values (everything is 0) https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/popover/index.js#L87

I think that at some point the dom manipulation make the element loose the relation to their parentElement and therefore the clientRect can not be calculated. But this is only a guess and i could not debug so far to prove this.

leutrimhusaj avatar Apr 30 '21 15:04 leutrimhusaj

I'm going to close the issue. I can no longer reproduce the bug.

Screenshot

Image

Mamaduka avatar May 08 '25 15:05 Mamaduka