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

HTML Block: Code shown in site editor browse mode #47819

Closed
talldan opened this issue Feb 7, 2023 · 5 comments · Fixed by #66440
Closed

HTML Block: Code shown in site editor browse mode #47819

talldan opened this issue Feb 7, 2023 · 5 comments · Fixed by #66440
Assignees
Labels
[Block] HTML Affects the the HTML Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented Feb 7, 2023

Description

The default view for the Custom HTML block is the HTML code editor mode.

When HTML blocks show up in the site editor in browse mode, they by default show their code, which isn't reflective of what browse mode is supposed to be—a reflection of the user's front-end.

Step-by-step reproduction instructions

  1. Open the site editor
  2. Add a custom html block with some basic content
  3. Enter browse mode

Expected: The block's code isn't shown, the html preview is.
Actual: The block's code is shown

Screenshots, screen recording, code snippet

Screen Shot 2023-02-07 at 5 28 23 pm

Environment info

Gutenberg trunk
Brave / Mac OS

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] HTML Affects the the HTML Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Feb 7, 2023
@talldan talldan moved this to ❓ Triage in WordPress 6.2 Editor Tasks Feb 7, 2023
@Mamaduka
Copy link
Member

Mamaduka commented Feb 9, 2023

I think the solution proposed by @mtias should fix this issue #41066 (comment).

See also #46834.

@ndiego ndiego moved this from ❓ Triage to 🗣️ In discussion, needs decision in WordPress 6.2 Editor Tasks Feb 9, 2023
@t-hamano
Copy link
Contributor

t-hamano commented Feb 10, 2023

Another PR: #46836

As noted in this comment, relying on isSelected for preview status might cause problems for keyboard users.

@t-hamano
Copy link
Contributor

My other concern is that this block may not necessarily contain content. Perhaps this is not the intended use, but for example, the following code:

html

If you preview this block, the block will be almost invisible:

preview

This border is also mentioned in #47818, but if this border were removed, the block would be completely invisible and one would not be able to click on the block directly. Personally, I think it is fine as it is now.

@ndiego
Copy link
Member

ndiego commented Feb 22, 2023

This border is also mentioned in #47818, but if this border were removed, the block would be completely invisible and one would not be able to click on the block directly. Personally, I think it is fine as it is now.

The border has been removed, so I agree that I think the implementation is ok as is. Not ideal, but not a blocker for 6.2.

@youknowriad
Copy link
Contributor

I think we could solve this by using isPreviewMode setting of the block editor.

@youknowriad youknowriad added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Oct 24, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] HTML Affects the the HTML Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants