Problem/Motivation
If you have dropbutton inside a td which uses input as its buttons, when you expand the dropbutton the item buttons will be too short. They will be only as long as their labels (i.e., value attributes), while the whole dropbutton will have the length of the longest label.
This is for example apparent in Paragraphs. Adding a new paragraph inside a container paragraph:

Only the underlined part of "Add Block" is a button. Clicking to the right of it just closes the dropbutton.
The same behavior can be reproduced in e.g., admin/structure/block by inserting an input option into a dropbutton there. (They normally use only a options.) Like so:
<li class="input-test dropbutton-action secondary-action"><input class="input-test-submit button js-form-submit form-submit" id="input-test" name="input_test" value="IT" type="submit"></li>
This behavior has been introduced in #2282599: Dropdown menus in most of core are broken in Stark.
Proposed resolution
Override /core/themes/stable/css/core/dropbutton/dropbutton.css in /core/themes/seven/css/components/dropbutton.component.css. Set the width of the input to 100% to fix this.
Before and after screenshots in #6.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | Content___Olivero.png | 468.34 KB | mherchel |
| #36 | 2890034-Screenshot.PNG | 49.41 KB | gaurav-mathur |
| #28 | Screen Shot 2020-09-01 at 8.17.35 AM.png | 325.42 KB | tanubansal |
| #27 | 2890034-27.patch | 1.08 KB | Vidushi Mehta |
| #22 | dropdown-before-patch.png | 28.18 KB | bandanasharma |
Comments
Comment #2
VladimirMarko commentedComment #3
idebr commented@VladimirMarko I confirmed the bug, but unfortunately we cannot change stable per https://www.drupal.org/docs/8/core/themes/stable-theme:
How about we override the selector in Seven's css instead in seven/css/components/dropbutton.component.css with the correct value?
Comment #4
VladimirMarko commentedI see. That sounds reasonable.
Comment #5
VladimirMarko commentedComment #6
idebr commented@Vladimir Cheers, your change looks great!
Some screencaps for good measure taken with the Paragraphs contributed module:
Dropbutton before:
Dropbutton after:
Comment #7
idebr commentedComment #8
lauriiiCould this bug exist elsewhere than inside a
tdelement? Is there some problem if we would apply this more globally than just for dropbuttons inside atd?Comment #9
idebr commentedRe #8
This was actually the approach in #2: fix the specificity of the selector in Stable. However, since the css for Stable is supposed to be frozen, we changed the approach in #4
The specificity is required to override the selector in Stable, see the patch in #1
Comment #11
VladimirMarko commentedThis patch is still working and still necessary for dropbuttons in Paragraphs.
Comment #12
star-szrStarted poking around this, looks like the styling in question was originally introduced in #1989470-171: Dropbutton style update for Seven before being moved to Stable.
Comment #13
xjmCSS-a-licious.
Comment #14
lauriiiI'm very sorry that it took so long for me to revisit this issue. Thanks @idebr for the explanation. That totally makes sense.
I think we should make a bug fix for this, but most likely it could be slightly more generic bug fix than this. The current solution only fixes the bug for input elements, but at least while reading the CSS it seems like we support button elements as well. Here's a demonstration how inconsistent the behavior of the
width: autois between these elements.Comment #18
geek-merlinThis should really be consolidated with the linked issue!
Comment #21
komalk commentedPatch #4 failed to apply on 9.1.
re-rolled the patch.
Comment #22
bandanasharma commented#21 patch is apply sucessfully on 9.1.x and I have check this with paragraph module. Adding after and before screenshot. I have check on IE, Firefox and chrome, it is working fine.
Comment #23
bandanasharma commentedComment #24
quietone commentedThanks for rerolling the patch and the manual testing!
Just a few more things to do here.
The patch has coding standard errors, https://www.drupal.org/pift-ci-job/1794488.
There is a request in #14 to make this fix more generic. The reroll is from a patch before that comment
Setting NW to address the above.
And let's add before and after screen shots to the issue summary. That will help reviewers.
Thanks
Comment #25
lauriiiThank you for the review @quietone!
I rechecked this and the bug is indeed specific to tables which is very confusing. That means, my feedback in #14 is not relevant.
The coding standard violations pointed out by DrupalCI are from CSSLint which is not used by Drupal core anymore since https://www.drupal.org/node/2868114. Moving back to RTBC
Comment #26
lauriiiHmm, probably what I was actually looking for in #14 was if we could remove this rule from
core/misc/dropbutton/dropbutton.css:This was added in #2282599: Dropdown menus in most of core are broken in Stark but I don't think it's needed anymore.
Comment #27
Vidushi Mehta commented@lauriii as per you've mentioned I've made that change.
Comment #28
tanubansal commentedTested #27, code changes are reflecting along with FE change
Comment #33
longwaveThe Seven theme has been removed from Drupal 10 core. However, moving this to core CSS as per #26.
Comment #35
gaurav-mathur commentedComment #36
gaurav-mathur commentedI have checked the issue without applying patch.I am not able to get the issue.
I checked this in drupal10.1.x-dev version with using seven theme.
For refer attached screenshots.
Comment #37
mherchelVerified this issue doesn't exist in 10.1.x with Claro (Seven is no longer in D10)
Closing this as outdated. Screenshot attached (note I manually modified the markup in devtools to test the CSS).