gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Heading block: toggling heading level alternates between displaying content and placeholder label

Open chthonic-ds opened this issue 5 years ago • 7 comments

Description

Toggling the heading level of a Heading block containing content will alternate between the content and the block's placeholder label.

Step-by-step reproduction instructions

  1. Add a Heading block.
  2. Add some text.
  3. Change the heading level via the block toolbar and observe the text is replaced by a placeholder label for the block.
  4. Change back to the initial level and observe the text reappears.

Expected behaviour

Text entered into the Heading block should persist when the level is changed.

Actual behaviour

Changing to a different heading level after text has been entered reverts to showing the block's placeholder label. Changing back to the initial heading level returns the user-entered text.

Screenshots or screen recording (optional)

heading-block-level-toggle-160621

WordPress information

  • WordPress version: 5.8-beta1
  • Gutenberg version: 10.8
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1 Blocks

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome 91.0.4472.106

chthonic-ds avatar Jun 16 '21 10:06 chthonic-ds

mmm 🤔 I'm not able to reproduce this personally. Anything specific about your install?

youknowriad avatar Jun 16 '21 13:06 youknowriad

@youknowriad, thanks for taking a look.

I don't think there's anything unique about the install, it's a simple test site with only Gutenberg active. When I have Gutenberg deactivated changing levels works as expected.

  • The theme in the screenshot is TT1 Blocks but I first experienced this with a different theme active.
  • Have tested with a fresh install of WordPress and Gutenberg.
  • There's a few Chrome violation notices but no errors in the console.

This does feel like the type of issue that would be easily replicated so I'm going to presume it's something unknown at my end. I'll close this for now and add an update if I work out why I'm seeing this.

chthonic-ds avatar Jun 16 '21 20:06 chthonic-ds

Thanks for following up, indeed it sounds intriguing.

There's a few Chrome violation notices but no errors in the console.

What kind of chrome violation?

I should also clarify that I'm not testing on Windows, so that could be a factor, would be good to get more folks testing this as well.

youknowriad avatar Jun 16 '21 21:06 youknowriad

Here's the Chrome violation notices I see when inserting the Heading block, adding content and switching levels:

[Violation] 'keydown' handler took 153ms index.js?ver=3dca987…36a0a9b5e818474df:1 [Violation] 'input' handler took 250ms index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:81 [Violation] 'mousemove' handler took 185ms index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] 'mousemove' handler took 152ms index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 [Violation] 'click' handler took 239ms index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] 'mousemove' handler took 179ms lodash.min.js?ver=4.17.19:88 [Violation] 'setTimeout' handler took 117ms index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 index.js?ver=07cd2ee…e490bc9bb6cf04bd:44 [Violation] 'mousemove' handler took 157ms

chthonic-ds avatar Jun 16 '21 21:06 chthonic-ds

Seems related: https://github.com/WordPress/gutenberg/issues/32753

chthonic-ds avatar Jun 16 '21 23:06 chthonic-ds

I think this got fixed via #32432.

I can reproduce the issue with Gutenberg 10.8.2, but not with 10.9.0-RC or the current trunk.

Mamaduka avatar Jun 17 '21 05:06 Mamaduka

That explains it I guess :)

youknowriad avatar Jun 17 '21 09:06 youknowriad