Problem/Motivation
Nesting a checkbox under a .container-inline container form element causes it to get a ":" appended via CSS (:after pseudo-element). Individual radio elements inside a radios group as well as individual checkbox elements inside a checkboxes element seem to be already excluded from this.
Steps to reproduce
- Install Drupal with the standard profile
- Add a field with multi-value support to the page content type
- Create a view, use fields, add the field with multi-value support
- In the modal to configure the View field, expand "Multiple Field Settings"
- Notice that the "Reversed" and "First and Last Only" checkboxes show a ":" after the label.
Proposed resolution
Add a CSS rule to exclude a single checkbox from having a trailing ":", when nested in a .container-inline
Remaining tasks
- Implement fix
- Discuss and review
User interface changes
- Individual checkbox elements do not show a trailing ":", when nested inside a .container-inline.
API changes
- None
Data model changes
- None
Release notes snippet
- TODO
| Comment | File | Size | Author |
|---|---|---|---|
| #40 | After-applying-patch.png | 103.64 KB | sd9121 |
| #40 | Before-applying-patch.png | 113.16 KB | sd9121 |
| #35 | Screenshot from 2023-06-27 13-34-39.png | 51.69 KB | jedihe |
| #34 | 3329699-trailing-colon-inline-checkbox-34.patch | 1.78 KB | jedihe |
| #25 | interdiff-20_25.txt | 1.9 KB | gauravvvv |
Issue fork drupal-3329699
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 #2
jedihe commentedAttaching screenshot from a simplytest.me instance.
Comment #3
jedihe commentedComment #5
jedihe commentedAttaching patch from current MR.
Manually tested in a simplytest.me instance; bug is fixed:
Comment #6
Bushra Shaikh commentedComment #7
Bushra Shaikh commentedComment #8
jedihe commentedComment #9
smustgrave commentedCan confirm this fixes the issue.
Comment #10
longwaveThe same CSS is in starterkit_theme and Umami; should the same fixes be applied there?
Also, we have a similar rule for radios, so is it worth adding the same fix for
.container-inline .form-type--radio label:after?Comment #11
smustgrave commentedUmami maybe? Would need to see this scenario from a frontend standpoint. (Screenshots needed)
Starterkit_theme I think yes as this could be copied for a backend theme maybe?
Comment #12
gauravvvv commentedUpdated it for
radioelement as well.Also, Made changes in
Starterkit_themeandUmami theme.\
Tried finding a scenario where it is used, but didn't find any. We're using same CSS for all, to keep it uniform updated it in umami as well.
Comment #13
rishabh vishwakarma commentedIGNORE
Comment #14
shani mauryaComment #15
shani mauryaI tested the Patch #12 and it is working fine. Please find the attached image for the results.
Thank You!!
Comment #16
shani mauryaComment #19
longwaveShould this be
.form-type-radiosor.form-type--radio?I suppose we need a form with inline radio buttons to be able to actually test this.
Comment #20
gauravvvv commentedYes it is
.form-type--radio. I have updated the patch.Comment #21
akshay kashyap commented@Gauravvvv Thanks for the work. I have applied your patch its working fine on chrome and Firefox browser and also attached the screenshot for the same
Comment #22
akshay kashyap commentedComment #23
akshay kashyap commentedComment #24
aziza_a commentedApplied the patch on #43 and it works, but have not updated there is a typo in class name that it should be .form-type--radio and not .form-type-radio, so moving it to need work again
Comment #25
gauravvvv commentedUpdated selector and attached interdiff.
Comment #28
kunal_sahu commentedI have created an MR , Please review.
This CSS code will remove the trailing colon from the label of the last checkbox in a group of nested checkboxes inside an element with the class ".container-inline".
Hope this works. Thanks
Comment #30
smustgrave commentedI believe #20 was correct. I can't find any reference to form-type--radio in the repo.
If the MR 3168 is the way. Explain why with screenshots.
Comment #32
jedihe commentedComment #33
jedihe commentedJust fixed the merge conflict for MR 3168.
@kunal_sahu's work made me realize we have to handle 2 cases: with and without description. For elements with a description, keeping the trailing ':' could make sense (notice the gray description right after "Reversed:"):
Looking at the original code, it looks like the trailing ':' was added precisely to handle the case "with-description".
Taking all this into account, I'll switch to using only the :last-child selector.
@smustgrave: I was able to see .form-type--radio in the HTML source, probably constructed dynamically.
Comment #34
jedihe commentedAttaching the patch for the current state of the MR.
Comment #35
jedihe commentedNew patch works great, IMHO:
(This is on Drupal 10.1.0 + patch, using Gin theme).
Comment #36
jedihe commentedComment #37
smustgrave commentedCan before/after screenshots be updated.
Also can the MR be updated for 11.x please
Believe jedihe is working on this so please no one vulture it.
Thanks!
Comment #38
sd9121 commentedComment #40
sd9121 commentedI have raised the PR against 11.x and have attached before/after screenshots to demonstrate the UI changes introduced by the patch.
Comment #41
smustgrave commentedScreenshots appear to be the same but would need to be part of the summary