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

Comments

Lendude created an issue. See original summary.

gauravvvv’s picture

Status: Active » Needs review
StatusFileSize
new596 bytes

I have removed the checkbox and attached patch for same, please review

Status: Needs review » Needs work

The last submitted patch, 2: 3375806-2.patch, failed testing. View results

urvashi_vora’s picture

Assigned: Unassigned » urvashi_vora

I will check this.

Thanks

urvashi_vora’s picture

Assigned: urvashi_vora » Unassigned
Status: Needs work » Needs review
StatusFileSize
new13.76 KB
new12.89 KB
new596 bytes

I 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:
Before

After patch:
After

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

urvashi_vora’s picture

Please ignore the patch "3375806-6.patch" added in #6. It is similar to #2.

lendude’s picture

Title: Views 'Rearrange' dialog show the 'Remove' checkbox, which should be hidden » Views 'Rearrange' dialog show the 'Remove' checkbox, which should be visually hidden
Issue summary: View changes
Status: Needs review » Needs work

We 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

urvashi_vora’s picture

Status: Needs work » Needs review
StatusFileSize
new905 bytes

Hi @Lendude,

I re-checked the issue, for making the checkbox visually hidden, we already have these lines of css

/* Hide 'remove' checkboxes. */

.views-remove-checkbox {
  display: none;
}

in views_ui.admin.theme.css in claro/css/theme.

But, there is also a conflicting css in drupal,

.form-boolean {
    <strong>display: inline-block;</strong>
    box-sizing: border-box;
....

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

/* Hide 'remove' checkboxes. */
.form-boolean.views-remove-checkbox {
  display: none;
}

Since, this is my first time working on these kind of issues, if any mistake is there, please guide me.

Thanks

Harish1688’s picture

reviewing this.

tinto’s picture

Component: Claro theme » views_ui.module
Issue tags: +ddd2023
StatusFileSize
new847 bytes

Hi 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-hide class 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!

urvashi_vora’s picture

@tinto, it was new for me. I will remember this approach. Thanks 😃

Harish1688’s picture

StatusFileSize
new38.15 KB
new37.29 KB

Hi,

Tested both patches, 3375806-9.patch and 3375806-11.patch, and they are both working well. However, I found that adding the class js-hide to 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:
issue image

Gin Theme:
issue image

Looks good for RTBC+

tinto’s picture

Thanks 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.

lendude’s picture

StatusFileSize
new2.79 KB
new3.62 KB

Added 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

tinto’s picture

StatusFileSize
new111.54 KB

Applying the patch posted here seems to create another issue: the "Remove" links no longer properly align with the table column header.

Remove links no longer align properly with the table column header label

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.

The last submitted patch, 15: 3375806-15-TEST_ONLY.patch, failed testing. View results

finne’s picture

Assigned: Unassigned » finne
finne’s picture

Assigned: finne » Unassigned
Status: Needs review » Reviewed & tested by the community

Review: patch looks good.
This makes the behaviour identical to other views dialogs such as sort. The misalignment can be addressed in the followup.

  • lauriii committed 597cf49e on 11.x
    Issue #3375806 by urvashi_vora, Lendude, tinto, Harish1688, finne: Views...

  • lauriii committed be4ba84f on 10.1.x
    Issue #3375806 by urvashi_vora, Lendude, tinto, Harish1688, finne: Views...
lauriii’s picture

Version: 11.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 597cf49 and pushed to 11.x. Thanks! Also cherry-picked to 10.1.x as a non-disruptive bug fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.