Problem/Motivation
Currently some blocks are not draggable in the Layout Builder + UI, because they may contain interactive elements link oEmbeds, linked elements, form elements etc. #3424439: Disable block links already started to solve this, but only does it for links.
Steps to reproduce
- Create an inline block type with remote video oEmebeds
- Configure inline block type display to output the oEmbed content
- Add on of these inline blocks to a layout and try to drag it around - e.g. for YouTube oEmbeds, dragging is not possible, but a click on the block starts the video
Proposed resolution
- At best reuse core's implementation in
layout_buildermodule's JS, where interactive elements are disabled in inline blocks (seelayout_builder/js/layout-builder.jsand especiallybehaviors.layoutBuilderDisableInteractiveElements
Remaining tasks
- Create an issue fork an MR to solve this issue
User interface changes
- Blocks with interactive elements will be draggable in Layout Builder + UI
API changes
n/a
Data model changes
n/a
Issue fork lb_plus-3424578
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
tim bozeman commentedThat's a great call out! Thank you!
Comment #4
hctomYou're welcome - I also like your UI much more than the core UI, hehe!
Comment #6
tim bozeman commentedFantastic! 😊
I took this opportunity to reorganize the files a bit too after including layout-builders behavior to disable interactive elements. Surprisingly I still needed the styling and link drag disabling stuff from #3424439: Disable block links cause it wasn't covered in cores behavior.
¯\_(ツ)_/¯
Thanks again!
Comment #7
hctomI'm sorry, but we missed one important thing: The JS from core's Layout Builder UI to disable those elements was unfortunately not enough. I digged a little more through the code and what the JS actually does is adding a
tabindex="-1"to e.g. iFrame elements. But to get them draggable, there is the following CSS snippet needed as well (otherwise clicks on such elements will be handled by e.g. the iFrame content) - taken fromlayout_builder/css/layout-builder.css:Maybe this even solves your "issue" that you had to add the custom stylings from #3424439: Disable block links additionally.
Should I create a follow up, or should this ticket be reopened again?
Comment #10
tim bozeman commentedOh, that's right! I don't need the custom stylings now. 😅 Thank you very much!
Comment #11
hctomYeah, now oEmbed are also draggable again as well - Thank you so much!