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

Read more: can not set default underline using theme.json #56036

Closed
carolinan opened this issue Nov 10, 2023 · 1 comment · Fixed by #56038
Closed

Read more: can not set default underline using theme.json #56036

carolinan opened this issue Nov 10, 2023 · 1 comment · Fixed by #56038
Assignees
Labels
[Block] Read More Affects the Read More Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

carolinan commented Nov 10, 2023

What problem does this address?

The read more block is always a link, but it can not be styled as a link using theme.json. Not without using the "CSS" field and force overriding the current block CSS.

I added this block to my block template inside the post template / query loop specifically because I thought it would have more styling possibilities than the link in the excerpt block. But also because I did not want untranslatable text in my HTML template.
If I want the "read more" text string to show up in the excerpt block, I would have to have the text string like this:
<!-- wp:post-excerpt {"moreText":"Read more"} /--> Even though this is the default text.

The block has CSS that removes the default underline on the link.
This CSS overrides the CSS generated by theme.json: styles > blocks > core/read-more > typography > textDecoration.

From the block styles:

.wp-block-read-more:not([style*=text-decoration]), .wp-block-read-more:not([style*=text-decoration]):active, .wp-block-read-more:not([style*=text-decoration]):focus {
	text-decoration: none;
}

From my example theme.json:

.wp-block-read-more {
	text-decoration: underline; <--- This is overridden.
}

I think this CSS needs to be removed, -but I am unsure of how to do that without changing the look on existing websites.
@ntsekouras I am reading through #37649 but I can not find the reason for why the underline needed to be removed? Does it break the text underline option?

There is no way right now to set the default to showing an underline and then removing the underline on :hover.

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/read-more/style.scss#L4

Can we make it valid to use the link states, hover, focus, active and visited directly on this block, since
styles > blocks > core/read-more > elements > links does not work?

@carolinan carolinan added [Type] Enhancement A suggestion for improvement. [Block] Read More Affects the Read More Block [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Nov 10, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 10, 2023
@ntsekouras
Copy link
Contributor

I don't remember why we added that in the original PR, but it should probably be fixed with PR, by reducing the css specificity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Read More Affects the Read More Block [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.

2 participants