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

Consider consolidating the appearance of the Code and HTML Blocks #13934

Open
kjellr opened this issue Feb 18, 2019 · 8 comments
Open

Consider consolidating the appearance of the Code and HTML Blocks #13934

kjellr opened this issue Feb 18, 2019 · 8 comments
Labels
[Block] Code Affects the Code Block [Block] HTML Affects the the HTML Block [Type] Enhancement A suggestion for improvement.

Comments

@kjellr
Copy link
Contributor

kjellr commented Feb 18, 2019

As originally noted in #8435, the Code and HTML blocks are very similar in appearance. They're close, but they have some minor differences. The reason for these differences is not immediately apparent.

Since both are essentially code editors, I'd suggest we adjust them to use the same styles. My suggestion would be to change the Code block as the base, since it more closely matches the borders used when you switch to the code editor (light gray border, no rounded corners).

Screenshots

De-selected:
screen shot 2019-02-18 at 3 03 04 pm

Selected:
screen shot 2019-02-18 at 3 04 43 pm
screen shot 2019-02-18 at 3 05 05 pm

@kjellr kjellr added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Block] HTML Affects the the HTML Block [Block] Code Affects the Code Block labels Feb 18, 2019
@richtabor
Copy link
Member

As an alternative view, I'd suggest that these two blocks should be styled more differently.

They are very different blocks, with very different functionalities. The Code block displays code inside of a code tag on the frontend (which themes may style with .wp-block-code ), while the HTML block will actually render the code.

Perhaps something as simple as a background color applied to .wp-block-code (and the textarea within the editor) would be effective.

Screenshots

De-selected:
screen shot 2019-03-04 at 1 44 06 pmscreen shot 2019-03-04 at 1 44 36 pm

Selected:
screen shot 2019-03-04 at 1 45 29 pm

screen shot 2019-03-04 at 1 45 41 pm

@joyously
Copy link

joyously commented Mar 4, 2019

Is this about styling only the editor UI, or the block itself (back and front match)?
Either way, if you use a background color, be sure to specify a foreground color at the same time. Themes can be dark, you know?

@richtabor
Copy link
Member

Is this about styling only the editor UI, or the block itself (back and front match)?

Both - as they should match. And valid point. ✅

@enriquesanchez
Copy link
Contributor

enriquesanchez commented Jul 24, 2019

What if we added line numbers to the code block? This will make it look similar to how other code editors/snippets elsewhere look like, and hopefully matching the user's expectation.

code-block

@wittwitsan
Copy link
Member

After discussing this in the Design Team slack today, we agreed to add the numbered lines to visualize the Code block and show up for both Editor and frontend, with the option to turn them off.

@mapk mapk added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Mar 10, 2020
@paaljoachim
Copy link
Contributor

Adding line numbers to the Code Block is a very good idea!

A thought that come up as I again read through the above comments.
What if we add background and text color to the Code Block?
One could add a light grey background.
As a user might want to add some variation in how code is seen.

@joyously
Copy link

What if we add background and text color to the Code Block?

Please don't! That is a job for themes, not the editor or the block. color options are especially difficult to overcome if the editor has styles for it.

@paaljoachim
Copy link
Contributor

Good point Joy.
It was a random (not that great of a) thought..:)

@mtias mtias removed the Needs Dev Ready for, and needs developer efforts label Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Code Affects the Code Block [Block] HTML Affects the the HTML Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

8 participants