Problem/Motivation
Open the 'Fields' or 'Sort' (not Filters) rearrange dialog on any view that has fields or sorts. It will show the checkbox that is used by the form to remove the handler from the View. This checkbox shouldn't be visible, we have the 'Remove' link for this.
Stark visually hides this checkbox correctly.

Steps to reproduce
Open the 'Fields' or 'Sort' (not Filters) rearrange dialog on any view that has fields or sorts
Proposed resolution
Visually hide the checkbox.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 3375806-11-applied.png | 111.54 KB | tinto |
| #15 | 3375806-15.patch | 3.62 KB | lendude |
| #15 | 3375806-15-TEST_ONLY.patch | 2.79 KB | lendude |
| #13 | gin 3375806.png | 37.29 KB | Harish1688 |
| #13 | claro 3375806.png | 38.15 KB | Harish1688 |
Comments
Comment #2
gauravvvv commentedI have removed the checkbox and attached patch for same, please review
Comment #5
urvashi_vora commentedI will check this.
Thanks
Comment #6
urvashi_vora commentedI have checked this, it is proper that it is being rendered from rearrange.php.
If we remove this line of code
'#type' => 'checkbox'from Line number 124 in
$form['fields'][$id]['removed'], the issue seems to be fixed.I am attaching scrrenshots of before and after the patch.
Before patch:

After patch:

The patch provided in #2 is working fine. However, I too tried creating a patch but there is no difference between the created patch and existing patch, so it won't be ideal to upload the patch. I will leave this issue for review by the community.
Please review.
Thanks
Comment #7
urvashi_vora commentedPlease ignore the patch "3375806-6.patch" added in #6. It is similar to #2.
Comment #8
lendudeWe don't want to completely remove the checkbox from the form, since that is what removes the handler on submission. We need to visually hide it in Claro, like it already is in Stark.
Updated the title and IS to hopefully make this more clear
Comment #9
urvashi_vora commentedHi @Lendude,
I re-checked the issue, for making the checkbox visually hidden, we already have these lines of css
in views_ui.admin.theme.css in claro/css/theme.
But, there is also a conflicting css in drupal,
Because of this display: inline-block, the css of display:none, is not working. As soon as I uncheck the display: inline-block in inspector, it takes the display: none, and the checkbox gets visually hidden.
The css is conflicting because, the input tag of checkbox contains both the classes of .form-boolean and .views-remove-checkbox.
So, I have modified the existing code of css as
Since, this is my first time working on these kind of issues, if any mistake is there, please guide me.
Thanks
Comment #10
Harish1688 commentedreviewing this.
Comment #11
tintoHi everyone, thanks for the patches and proposed solutions! Great to see so many people working on this.
I've reviewed and discussed this with @lendude and @finne and we've found a few issues with #6 and #9. I think a better way to solve this is to simply add a
js-hideclass to the input element by the views ui module. This way it works in all themes and the checkboxes are only hidden when JavaScript is enabled.Please review the patch attached. Thanks again!
Comment #12
urvashi_vora commented@tinto, it was new for me. I will remember this approach. Thanks 😃
Comment #13
Harish1688 commentedHi,
Tested both patches, 3375806-9.patch and 3375806-11.patch, and they are both working well. However, I found that adding the class
js-hideto the input element using the Views UI module is a better approach. This change works perfectly on all other themes when switched. I specifically tested the 3375806-11.patch on two admin themes, Claro and Gin, and it worked perfectly on both of them. attached the images for reference .Testing steps:
1. Install the Drupal setup 11 and enabled the claro theme.
2. on path 'admin/structure/views/view/demo_testing' , applied the patch and verified the changes.
After patch 11:

Claro theme:
Gin Theme:

Looks good for RTBC+
Comment #14
tintoThanks for the review!
It's important to take into account when reviewing is that when you disable JavaScript in your browser, the checkboxes should be visible. When JS is enabled, they should be (visually) hidden.
Comment #15
lendudeAdded a test for making sure the field removal checkbox still works, since there was only a non-javascript test for this, now added a JS test to make sure the correct checkboxes and links are shown and the checkbox gets set when using the remove link
The test only file uses Claro, where the patch with the fix uses stark. I think, going forward it's better to test this in stark since that is more in line with our other tests in views. So test-only file is sort of the interdiff
Comment #16
tintoApplying the patch posted here seems to create another issue: the "Remove" links no longer properly align with the table column header.
This is because the patch hides the input element, but not the wrapper div.
I think this can only be fixed in the (admin) theme, so I will open a separate follow-up issue that addresses this.
Comment #18
finneComment #19
finneReview: patch looks good.
This makes the behaviour identical to other views dialogs such as sort. The misalignment can be addressed in the followup.
Comment #22
lauriiiCommitted 597cf49 and pushed to 11.x. Thanks! Also cherry-picked to 10.1.x as a non-disruptive bug fix.