tinymce / tinymce-docs

TinyMCE Documentation
https://www.tiny.cloud/docs/
Other
86 stars 221 forks source link

<detail> elements cannot be expanded without accordion plugin #3051

Open wesley-at-hl opened 8 months ago

wesley-at-hl commented 8 months ago

📝 Provide detailed reproduction steps (if any)

✔️ Expected result

I can expand/collapse because that is native html behavior

❌ Actual result

Nothing happens.

❓ Possible solution

It does not make sense to suppress native behavior when the added behavior to make it work is optional, so it should be either

TheSpyder commented 8 months ago

You haven't been able to click to toggle for many years in TinyMCE. The native behaviour of contenteditable=true is to toggle when clicking anywhere in the summary element, which is a terrible user experience. We can't detect whether that click is on the disclosure arrow, so we just block it completely. https://codesandbox.io/p/sandbox/frosty-wood-d6n6g3

When we added the accordion plugin we removed some old code which added open to details elements. This does unfortunately mean that the details element is left in the browser default state, collapsed.

Perhaps our docs need to be improved. The details_initial_state and details_serialized_state options are core behaviours, but they're listed as plugin options with just a small note that they don't require the plugin. These can be used to expand details elements automatically.