Problem/Motivation
Follow-up to #3246385: [drupalMedia] Support captions on <drupal-media>.
If an element inside <drupalMedia> model element is focused on editor, the contextual toolbar for the parent media element should be visible. This is required from consistency perspective because this is how the image widget works. At the moment also when caption is toggled on, it receives focus, meaning that the toolbar disappears immediately after toggling caption on.
This is how this looks currently:

Proposed resolution
Keep media contextual toolbar visible when the selection is in a child element of <drupalMedia>.
Remaining tasks
User interface changes
- Before

- After

API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 3264775-17-93x.patch | 86.66 KB | bnjmnm |
| #12 | 3264775-12-D10.patch | 86.49 KB | bnjmnm |
| #12 | 3264775-12-d9.patch | 86.65 KB | bnjmnm |
| #6 | Screenshot 2022-02-24 at 18.16.10.png | 255.35 KB | wim leers |
| #6 | Screenshot 2022-02-24 at 18.16.52.png | 251.57 KB | wim leers |
Issue fork drupal-3264775
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:
- 3264775-drupalmedia-toolbar-should
changes, plain diff MR !1881
Comments
Comment #2
lauriiiComment #4
wim leersTests were added, but aren't passing yet.
Comment #5
lauriiiPushed changes that should fix the failing test
Comment #6
wim leersComment #7
wim leersHm, looks like the failure that https://git.drupalcode.org/project/drupal/-/merge_requests/1881/diffs?co... fixed has returned? 🧐
Just left one variable naming suggestion that would make it crystal clear to me, and once that's done (and this is green again), this is RTBC for me :)
Comment #8
wim leersAssuming this comes back green.
Will need patch for testing against 9.3 & 10.
Comment #10
bnjmnmA few things in the MR, one hopefully helps with some of the concerns in this thread.
Comment #11
lauriiiComment #12
bnjmnmReady to commit when the version-specific patches are green.
Comment #15
bnjmnmCommitted to 9.4.x and 10.0.x, and intend to commit to 9.3.x after the first-tuesday-of-the-month freeze window.
Comment #17
bnjmnmComment #19
bnjmnmBackported to 9.3.x now that the commit freeze is over.