Postponed (maintainer needs more info)
Project:
Drupal core
Version:
main
Component:
ckeditor5.module
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Dec 2023 at 06:00 UTC
Updated:
18 Mar 2026 at 10:41 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
sandeepsingh199 commentedThis is the issue of ckeditor5 alignment tool. This bug CF in drupal11 too. for quick fix you can write inline style in edit mode(html) of table
<table style="margin:0 auto;">.I have checked with Claro & Gin, table took by default 100% width. Olivero theme is working fine but the issue with table alignment.
I am looking into it. I will add a patch if found anything.
Comment #3
wim leersThanks for linking the related issue! And especially thanks for creating an upstream issue! 👏
Can you also reproduce this at https://ckeditor.com/docs/ckeditor5/latest/examples/builds/classic-edito...?
Comment #4
carp-enter commentedI have the same problem with Drupal 10.2.2 and PHP 8.2.15.
Comment #5
wim leersPlease see #3. We need that to be tested first.
For now, demoting to , until I've got a response to #3.
Comment #6
sumit saini commentedOn this link https://ckeditor.com/docs/ckeditor5/latest/examples/builds/classic-edito..., table properties plugin and source edit pluign is not available. So let me try to explain/reproduce this on https://ckeditor.com/docs/ckeditor5/41.1.0/examples/builds-custom/full-f....

There, I created 3 one cell tables with left(L), center(C) and right(R) alignment respectively as shown below
The html will render as below when viewed(generated html and its view can be checked here - https://jsfiddle.net/Lsepjmut ).

See that L and R tables are rendered as expected but the table C is left aligned instead of center aligned.
Because ckeditor5 only handled its look inside editor and did not account for the browser behaviour, this is a problem for
- pages rendered with drupal theme(easy fix is to attach extra css fix to handle it with theme)
- API responses for headless implementation (not possible to add a css fix for this case by drupal)
One solution to fix for both above cases, is to implement a text processor(filter) to add the necessary style properties but this sounds like a overhead already.
In the meantime, we can use the workaround suggested in #2 but this is not good UX for a non-technical contributor. So, it is better if this is fixed upstream by ckeditor5 (which unfortunately has been disagreed here https://github.com/ckeditor/ckeditor5/issues/15535#issuecomment-1864029206 ).
Comment #7
nitesh624I see upstream issue is closed. So is that something missing from Drupal side or we need to see any workaround plugin
Comment #8
smustgrave commentedShould this be closed?
Comment #9
francismak commentedWe have a user reporting this as well.
So when editing in CKEditor, the site included a script from:
web/core/assets/vendor/ckeditor5/table/table.js
This JS will create inline style on the page with
.ck-content .table{display:table;margin:.9em auto}
So by default, table is centered in CKEditor. User expected to see the same thing in frontend page, but theme is missing CSS rule for this.
No issue for align left/right since CKEditor will add inline CSS float left/right.
IMO, I don't think this is a bug, but a classic example of unexpected result between admin editing vs frontend viewing.
Comment #10
sbrown1038 commentedMy tables were centered until a couple of days ago when I updated Drupal Core. I checked with all of my installed themes and my outermost table is left aligned in View mode.
In Source mode in CKEditor, I noticed several instances of 100%px instead of 100%. With all due respect, I'm fairly certain this is the result of a bug.
Please refer to my reported issue https://www.drupal.org/node/3566162 which has been designated a duplicate of this issue for more info and uploaded files.
Thanks.
Steve
Comment #12
nitesh624if i put
align="center"property in table tab through source code My table is coming center.Ckeditor4 was adding this property to center align table
Comment #13
davidwhthomas commentedI have the same issue after upgrading Drupal core to 10.6.0
In the source view:
Adding
margin:0 auto;gets changed tomargin-top:0;margin-bottom:0and the "auto" is removed.Adding
align="center"to a table is also removed.This is when using a text format "Limit allowed HTML tags and correct faulty HTML" disabled.
I found this approach worked to preserve the styling:
Comment #14
nitesh624#13 seems to be working fine but do editor need to add class "
centered" by going to source or it can be handled through a custom plugin?Comment #15
nitesh624I think we need to handle it on frontend theme using css
Comment #16
nitesh624i see some new comment on https://github.com/ckeditor/ckeditor5/issues/15535#issuecomment-4076814652