Opened 2 years ago
Closed 13 months ago
#57463 closed feature request (wontfix)
Twenty Twenty Three has no base styles for <table>
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.1.1 |
Component: | Bundled Theme | Keywords: | reporter-feedback close |
Focuses: | Cc: |
Description
I am seeing that Twenty Twenty Three has no styles period, but I find this strange. As a plugin author who tries my best to inherit the theme's styles.... well that's not possible when there aren't styles. One of my plugins renders a <table>
and I would prefer it to look like any other tables on the site, but there is no style to inherit.
I tried adding a wp-block-table
class to a wrapper, but that doesn't help either since the style for the table block is in core and only loads when the table block is present.
What's the best suggestion here? I can style my own tables, but then they are destined to look different from the theme and it's not practical to provide different styles for every theme.
Change History (7)
#3
@
2 years ago
Hi!
It is not possible for a theme to make sure that all plugins are styled.
My first recommendation would be to use the table block instead of a custom table in your custom plugin. I do understand that is not always possible.
In your plugin, you can enqueue the block style by referring to it's block slug. Then it is loaded even if the block itself is not present.
-It will load as an extra, separate, css file.
Basic example for the frontend:
function prefix_test() { wp_enqueue_style( 'wp-block-table' ); } add_action( 'wp_enqueue_scripts', 'prefix_test' );
Aside: Note that the block places the wp-block-table class on the wrapping
figure
element and not on the table
.
#4
@
20 months ago
@helgatheviking Hi, I'm checking in to see if the suggestion above solves the problem.
#6
@
13 months ago
- Keywords close added
Whilst I understand this might be an issue for your table @helgatheviking in this case I am not sure I agree that all default themes should have styling for tables, particularly with the table block having default styling itself. I am wondering if the recommendation a while ago therefore from @poena does resolve this and as a tentative recommendation will add the close keyword. We can always review this.
Thanks for the report!
This could be a bigger issue than just the bundled themes. Twenty Twenty-Two does not have basic
table
styles either. Other block themes such as Jaxon and EduBlock do not have them, but Greenshift does.To work around that and to avoid overriding theme styles, you could try using the
:where()
selector.