I was working on adding SB and a component last week as well and found this too late. I've merged my work (adds a button component and a fix for radix root making autodoc components too high). and opened an MR. Would be great to get this merged so we can split out the work for storybook components.
tinarey β made their first commit to this issueβs fork.
I created a new fork and did a bit of work on this β it's a rough WIP but there's a few native dialogs now :) (added 2 screenshots)
- created a new library dialogNative
with the idea to have both in parallel and switch over bit by bit
- changed editor and field_ui to use the new library:
editor: on a wysiwyg field, change the text format between basic_html and full_html
field_ui: on a content type, manage fields and attempt to delete one
in both cases a native dialog should pop up and the buttons should work
Notes/questions/next steps
- The existing Drupal.dialog.showModal()
and the native showModal()
function have the same name, which gets slightly confusing.
- showModal()
and show()
seem to be doing mostly the same thing, just one with and one without backdrop? What did I miss?
- Atm I've just set app/core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
and app/core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
to use the new native library but if we want both in parallel, this probably needs another solution. Too backend-y for me.
- Currently ajax response data is just put out again as is, this probably needs some checks.
- There's currently nothing for focus, tabbable, or the whole button change thing, I assume we need some of that back in.
- Needs tests
- Needs styling
TinaRey β made their first commit to this issueβs fork.
I could replicate the issue in a pretty fresh Drupal 10 install with full_html, other formats with several ways of adding tags, ids, classes etc in the allowed list etc and at some point noticed that the h2 doesn't get stripped if it's applied via UI; only via source. That's when I went to their demo page for the "source" button which says it allows all sorts of dangerous html. The test case is as minimal as
<h2>
<div>Test</div>
</h2>
I left a comment in the upstream issue https://github.com/ckeditor/ckeditor5/issues/13803#issuecomment-1558319636
Looks like this might be the same:
https://www.drupal.org/project/drupal/issues/3349893
π
[upstream] [GHS] CKEditor 5 removes s that wrap HTML elements not natively supported by CKEditor 5
Fixed
(added this issue to the CKEditor report).
Looks like that's a ckeditor bug, it happens on the demo page for the source input https://ckeditor.com/ckeditor-5/demo/html-support/
If you select h2 via the heading dropdown, it stays.