Skip to content

Custom HTML: Add a persistent inline source-editing option #83020

Open

Description

@inigagah

What problem does this address?

Editing existing Custom HTML blocks can be cumbersome when the surrounding page layout provides useful context. The block displays a preview, while editing its source requires opening a separate modal.

For example, someone might maintain several HTML blocks alongside headings, columns, and other content. Opening each block’s code editor obscures those visual landmarks, making it harder to keep their place while working across blocks. Switching the entire page to Code Editor exposes the source but loses that visual context.

Preview is also not always the most useful representation of custom HTML. Content such as tooltips may depend on site-level CSS that is not reflected in the preview. In that case, explanatory text intended to appear only on hover could appear inline, creating a cluttered preview while the source remains an extra step away.

What is your proposed solution?

Offer an optional inline source-editing mode for Custom HTML blocks within the visual editor, with a remembered preference for source or preview.

This would allow users to:

  • View and edit HTML alongside surrounding blocks, preserving the page’s visual context.
  • Keep their preferred editing mode when reopening the editor.
  • Switch to Preview when needed.
  • Use this mode with existing Custom HTML blocks without converting their content.

The current preview experience could remain the default. The proposed option would support workflows where direct access to HTML is more useful than its rendered preview.

Related: Core Trac #65332 and Gutenberg PR #78688.

I’m opening this issue to start a discussion about the editing workflow and help establish a design direction. A remembered inline source-editing preference is one possible approach; I’m open to alternatives that keep HTML source accessible alongside the surrounding page layout.

Activity

  1. added
    [Type] Enhancement
    on Sep 16, 2026
  2. added
    [Block] HTML
    on Sep 16, 2026
  3. talldan commented on Sep 17, 2026

    @talldan
    Contributor

    I'm personally not sure inline editing would be better. What if you have a longer HTML / JS / CSS code, but it results in a small HTML preview? Switching tabs makes the post content jump around because of the different content lengths. That was something that happened with the previous experience, even with the one HTML tab. The balancing act was to have a fixed height for the HTML code editor, but then people complained it was too small. There's no great solution.

    That's not to say there aren't improvements that can be made and that there aren't problems with the current experience, so it'd be good to keep the discussion running, but I think it's not great to offer an alternative that also has so many issues.

  4. added
    [Status] In discussion
    on Sep 17, 2026
  5. kenji-hayakawa-gh commented on Sep 21, 2026

    @kenji-hayakawa-gh

    Just wanted to jump in with some context, as I think there is a basic misunderstanding here.

    I'm personally not sure inline editing would be better.

    While this is no doubt the case for some users, this reply misunderstands the original post. OP writes as follows:

    Preview is also not always the most useful representation of custom HTML.

    Note the phrase "not always". It is therefore not an objection to say that some users would prefer Preview over Code. The objection should be that Preview is always the most useful representation of Custom HTML.

    There have been good suggestions for giving users the option to make Code the default view. Adding that option does not affect the current UX of users who prefer Preview by default. I hope the above clarifies some basic points and moves things forward.

    P.S. Also, note that many users have complained about being locked into Preview since 22.1.0. The proposed change to give these and other users the option to make Code the default view is a clean solution to this complaint that does not affect the UX of other users.

    P.P.S. The design of the Code view (e.g. the height of the Custom HTML block, whether to make it a fixed height, etc.) is a separate issue, but a wholesale rejection of any option to make Code the default is not an adequate solution to user complaints about the design of the Code view. A more plausible approach is to give users the option to choose a Code view, and then attempt to make improvements to that modal Code view from there.

  6. talldan commented on Sep 22, 2026

    @talldan
    Contributor

    @kenji-hayakawa-gh I'm not sure I did misunderstand. The title of the issue is "Add a persistent inline source-editing option", so what I mentioned is how inline editing caused issues, and that I don't believe it's a good option. That's based on past experience and the criticism from others of how the block worked before.

    Also, note that many users have complained about being locked into Preview since 22.1.0.

    There are some issues already:

    I do think there are valid criticisms. However, often the feedback is too quick to suggest going back to how it was before.

    I think the acknowledgement is that there are some interesting use cases for the block, and it doesn't support all of them well. The main use case it does support is adding some HTML that might be augmented with JS and CSS.

    The editor canvas is geared to show visible content, so when a block shows nothing it can be challenging (Spacer also has similar issues). I'm personally not against different preview options though, perhaps placeholder options on the block could be useful for code that generates HTML, similar to how an empty image block looks.

    but a wholesale rejection of any option to make Code the default is not an adequate solution to user complaints about the design of the Code view.

    A rejection would be closing the issue. Instead I kept it open to allow further discussion and added the [In Discussion] label.

    In my viewpoint I do also try to keep with the philosophy here - https://wordpress.org/about/philosophy/.

  7. kenji-hayakawa-gh commented on Sep 22, 2026

    @kenji-hayakawa-gh

    I'm personally not against different preview options

    This is basically what it comes down to, and I'm glad we're on the same page here. Some of us have built our websites and workflows around the Custom HTML block's UI prior to the 22.1.0. update. OP has helpfully provided links to tickets which list the issues caused by the 22.1.0. update. We just need a practical solution that addresses these issues, and adding the option to allow users to choose the Code view as their default (note: choose, not force) seems to be the most straightforward solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] HTML[Status] In discussion[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions