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

Rename "caption" element to "figcaption" #61261

Open
huubl opened this issue Apr 30, 2024 · 2 comments
Open

Rename "caption" element to "figcaption" #61261

huubl opened this issue Apr 30, 2024 · 2 comments
Labels
[Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.

Comments

@huubl
Copy link
Contributor

huubl commented Apr 30, 2024

What problem does this address?

The current implementation in theme.json utilizes the caption key in elements to target <figcaption> . However, in HTML, figcaption is specifically designed for captions of figures, while caption is designated for table captions.

I think it's beter to have both keys available in elements, but right now there's no place for a new "caption" element, since this key is used for "figcaption".

What is your proposed solution?

I proprose adding both elements: "caption" and "figcaption" to theme.json, or at least renaming "caption" to "figcaption" for now. This future-proofs the codebase to allow separately targeting the elements base styles, and it aligns with HTML semantics.

It would be best to include this in upcoming theme.json version 3 if possible.

@huubl huubl added the [Type] Enhancement A suggestion for improvement. label Apr 30, 2024
@richtabor
Copy link
Member

Why shouldn't caption and figcaption utilize the same styling?

Also, at least currently, the table does use a figure + figcaption:

CleanShot 2024-05-02 at 09 23 18

@huubl
Copy link
Contributor Author

huubl commented May 2, 2024

Indeed, while the table block currently uses <figcaption>, it should use <caption> instead. Also see: #47984 (comment)

The distinction between <caption> and <figcaption> is crucial, as they serve different purposes in HTML. This article on Medium lists the difference between the two tags.

Therfore, it seems logical to allow configuring different base styles for caption and figcaption in elements.

In my opinion element naming in theme.json should follow HTML standards if possible.

@jordesign jordesign added the [Block] Image Affects the Image Block label May 5, 2024
@huubl huubl changed the title Rename "caption" element to "figcaption" in theme.json V3 Rename "caption" element to "figcaption" May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants