Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Text links need improved styles #108

Closed
kjellr opened this issue Oct 13, 2021 · 6 comments · Fixed by #220
Closed

Text links need improved styles #108

kjellr opened this issue Oct 13, 2021 · 6 comments · Fixed by #220
Labels
[Type] Enhancement New feature or request
Milestone

Comments

@kjellr
Copy link
Collaborator

kjellr commented Oct 13, 2021

From the mockups:


image


  • Links need more refined text-decoration styles, so that the thin font isn't paired with a horribly thick underline. (I think we could probably elevate this issue from "enhancement" to a "bug" because of this bullet).
  • Link underlines should become dotted on hover and in their active state.
  • Focus state should be dotted.
  • The mockups indicate that large post titles should not have underlines by default, but that their hover and active states should have a solid underline.

May end up being related to: #99
Upstream issue: WordPress/gutenberg#27075

@kjellr kjellr added the [Type] Enhancement New feature or request label Oct 13, 2021
@kjellr kjellr added this to the Beta 1 milestone Oct 13, 2021
@kjellr
Copy link
Collaborator Author

kjellr commented Oct 13, 2021

Links need more refined text-decoration styles, so that the thin font isn't paired with a horribly thick underline. (I think we could probably elevate this issue from "enhancement" to a "bug" because of this bullet).

If we get desperate, this would take like two lines of CSS to fix:

a {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25ch;
}
Before After
Screen Shot 2021-10-13 at 2 09 13 PM Screen Shot 2021-10-13 at 2 04 01 PM

@jffng
Copy link
Collaborator

jffng commented Oct 13, 2021

Regarding those two lines of CSS, I wonder if they will be supported via the theme.json elements API.

In other words, should we be able to declare styles.elements.link.typography.textDecorationThickness and .textUnderlineOffset?

@gregrickaby
Copy link
Contributor

gregrickaby commented Oct 14, 2021

@kjellr @jffng Could I pick this one up? I'll try using theme.json first, and fall back to CSS.

@kjellr
Copy link
Collaborator Author

kjellr commented Oct 14, 2021

You're welcome to give it a shot, @gregrickaby! Just know that this might be a little difficult to sort out. I'm really hesitant to use CSS (so far, we don't even enqueue style.css in the editor yet since it's not needed), but the mechanisms to make this happen in theme.json don't exist yet. The most ideal solution is to get those built into Gutenberg somehow as part of WordPress/gutenberg#27075. There's been very little movement there yet, so this may end up being a little bit of a dead end.

@gregrickaby
Copy link
Contributor

gregrickaby commented Oct 14, 2021

Good to know. I'll look for another issue then. 😅

Appreciate the heads up @kjellr!

@carolinan
Copy link
Collaborator

Here is how to manipulate theme.json to include the thickness:

	"core/post-title": {
				"typography": {
					"fontFamily": "var(--wp--preset--font-family--source-serif-pro)",
					"fontWeight": "300",
					"lineHeight": "var(--wp--custom--typography--line-height--tiny)",
					"fontSize": "var(--wp--custom--typography--font-size--gigantic)"
				},
				"elements":{
					"link": {
						"typography": {
							"textDecoration": ";text-decoration-thickness: 1px; text-underline-offset: 0.25ch;"
						}
					}
				}
			},

The key is closing the textDecoration with the extra ;
image

It's definitely hacky. Its also very small.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
[Type] Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants