Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/wp#46 - Remove styling that attempts to make inputs match select2 #16882

Merged
merged 1 commit into from
Apr 27, 2020

Conversation

wmortada
Copy link
Contributor

@wmortada wmortada commented Mar 23, 2020

Overview

CiviCRM applies some styling that attempts to make select elements match select2 styling. Unfortunately, this can conflict with the styles applied by the CMS. In particular it causes issues with WordPress 5.3 which applies it's own styling for select elements. See https://lab.civicrm.org/dev/wordpress/issues/46.

In any case the styling that CiviCRM applies is different from select2 styling so select elements don't look the same.

This PR removes CiviCRM's styling so that select elements appear as the browser and/or CMS intended. This fixes the issue with WordPress 5.3 and should hopefully reduce the chance of issues in future.

Unfortunately, this change does mean that the select element loses some of it's styling and rounded corners in other CMSs (i.e. Drupal, Backrop and Joomla) but I can't see an easy way round this problem. As you can see from the testing I've done (see below) the select element is not rendered consistently across platforms in any case.

Before

select in WordPress 5.2 / CiviCRM 5.23:

image

select in WordPress 5.3 / CiviCRM 5.23:

image

Note that this select is missing an arrow so doesn't look like a select element.

After

select in WordPress 5.2 / CiviCRM 5.25 plus patch:

image

select in WordPress 5.3 / CiviCRM 5.25 plus patch:

image

Note the difference in the styling applied by WordPress 5.2 vs 5.3.

Technical Details

The above screenshots were produced on Firefox 74.0 on Ubuntu Linux 18.04

Comments

There is another PR by @JGaunt that attempts to fix the same issue in a different way - #16738

Testing notes

Because the styling is dependent on the operating system, browser and CMS, it should ideally be tested in a full range of platforms. The select element will likely look different in each.

This means each of the following CMSs:

  • WordPress 5.2
  • WordPress 5.3
  • Drupal 7
  • Drupal 8
  • Joomla
  • Backdrop

And the most common operating systems and browsers:

  • Windows
    • Chrome
    • Firefox
    • Edge
    • IE
  • Mac OS X
    • Chrome
    • Safari
  • Android
    • Chrome
    • Samsung browser
  • iOS
    • Chrome
    • Safari

Test results

I've put this into tables because there are a lot of combinations! Blank cells in the grid indicate that it is still to be tested.

For testing purposes I've chosen to look at the 'Mailing Job Status' select field from the Mailings section in Advanced Search.

This is a work in progress. Any help with testing would be much appreciated!

Drupal 7 / CiviCRM 5.25

OS / Browser Before PR After PR
Windows 10 / Chrome Drupal 7 CiviCRM 5 26 Windows Chrome Before Drupal 7 CiviCRM 5 26 Windows Chrome After
Windows 10 / Firefox Drupal 7 CiviCRM 5 26 Windows Firefox Before Drupal 7 CiviCRM 5 26 Windows Firefox After
Windows 10 / Edge Drupal 7 CiviCRM 5 26 Windows Edge Before Drupal 7 CiviCRM 5 26 Windows Edge After
Windows 10 / IE Drupal 7 CiviCRM 5 26 Windows IE Before Drupal 7 CiviCRM 5 26 Windows IE After
Mac OS X / Chrome
Mac OS X / Firefox
Mac OS X / Safari
Android / Chrome Drupal 7 CiviCRM 5 26 Android Chrome Before Drupal 7 CiviCRM 5 26 Android Chrome After
Android / Samsung browser Drupal 7 CiviCRM 5 26 Android Samsung Internet Before Drupal 7 CiviCRM 5 26 Android Samsung Internet After
iOS / Chrome
iOS / Safari
Ubuntu 18.04 / Chrome Drupal 7 CiviCRM 5 25 Ubuntu Chrome Before Drupal 7 CiviCRM 5 25 Ubuntu Chrome After
Ubuntu 18.04 / Firefox image image

WordPress 5.2 / CiviCRM 5.26

OS / Browser Before PR After PR
Windows 10 / Chrome WordPress 5 2 CiviCRM 5 26 Windows Chrome Before WordPress 5 2 CiviCRM 5 26 Windows Chrome After
Windows 10 / Firefox WordPress 5 2 CiviCRM 5 26 Windows Firefox Before WordPress 5 2 CiviCRM 5 26 Windows Firefox After
Windows 10 / Edge WordPress 5 2 CiviCRM 5 26 Windows Edge Before WordPress 5 2 CiviCRM 5 26 Windows Edge After
Windows 10 / IE WordPress 5 2 CiviCRM 5 26 Windows IE Before WordPress 5 2 CiviCRM 5 26 Windows IE After
Mac OS X / Chrome
Mac OS X / Firefox
Mac OS X / Safari
Android / Chrome WordPress 5 2 CiviCRM 5 26 Android Chrome Before WordPress 5 2 CiviCRM 5 26 Android Chrome After
Android / Samsung browser WordPress 5 2 CiviCRM 5 26 Android Samsung Internet Before WordPress 5 2 CiviCRM 5 26 Android Samsung Internet After
iOS / Chrome
iOS / Safari
Ubuntu 18.04 / Chrome WordPress 5 2 CiviCRM 5 26 Ubuntu Chrome Before WordPress 5 2 CiviCRM 5 26 Ubuntu Chrome After
Ubuntu 18.04 / Firefox WordPress 5 2 CiviCRM 5 26 Ubuntu Firefox Before WordPress 5 2 CiviCRM 5 26 Ubuntu Firefox After

WordPress 5.4 / CiviCRM 5.26

OS / Browser Before PR After PR
Windows 10 / Chrome WordPress 5 4 CiviCRM 5 26 Windows Chrome Before WordPress 5 4 CiviCRM 5 26 Windows Chrome After
Windows 10 / Firefox WordPress 5 4 CiviCRM 5 26 Windows Firefox Before WordPress 5 4 CiviCRM 5 26 Windows Firefox After
Windows 10 / Edge WordPress 5 4 CiviCRM 5 26 Windows Edge Before WordPress 5 4 CiviCRM 5 26 Windows Edge After
Windows 10 / IE WordPress 5 4 CiviCRM 5 26 Windows IE Before WordPress 5 4 CiviCRM 5 26 Windows IE After
Mac OS X / Chrome
Mac OS X / Firefox
Mac OS X / Safari
Android / Chrome WordPress 5 4 CiviCRM 5 26 Android Chrome Before WordPress 5 4 CiviCRM 5 26 Android Chrome After
Android / Samsung browser WordPress 5 4 CiviCRM 5 26 Android Samsung Internet Before WordPress 5 4 CiviCRM 5 26 Android Samsung Internet After
iOS / Chrome
iOS / Safari
Ubuntu 18.04 / Chrome WordPress 5 4 CiviCRM 5 26 Ubuntu Chrome Before WordPress 5 4 CiviCRM 5 26 Ubuntu Chrome After
Ubuntu 18.04 / Firefox WordPress 5 4 CiviCRM 5 26 Ubuntu Firefox Before WordPress 5 4 CiviCRM 5 26 Ubuntu Firefox After

Drupal 8 / CiviCRM 5.26

OS / Browser Before PR After PR
Windows 10 / Chrome  Drupal 8 CiviCRM 5 26 Windows Chrome Before  Drupal 8 CiviCRM 5 26 Windows Chrome After
Windows 10 / Firefox Drupal 8 CiviCRM 5 26 Windows Firefox Before   Drupal 8 CiviCRM 5 26 Windows Firefox After
Windows 10 / Edge Drupal 8 CiviCRM 5 26 Windows Edge Before   Drupal 8 CiviCRM 5 26 Windows Edge After
Windows 10 / IE Drupal 8 CiviCRM 5 26 Windows IE Before   Drupal 8 CiviCRM 5 26 Windows IE After
Mac OS X / Chrome    
Mac OS X / Safari    
Android / Chrome  Drupal 8 CiviCRM 5 26 Android Chrome Before  Drupal 8 CiviCRM 5 26 Android Chrome After
Android / Samsung browser Drupal 8 CiviCRM 5 26 Android Samsung Internet Before   Drupal 8 CiviCRM 5 26 Android Samsung Internet After
iOS / Chrome    
iOS / Safari    
Ubuntu 18.04 / Chrome  Drupal 8 CiviCRM 5 26 Ubuntu Chrome Before  Drupal 8 CiviCRM 5 26 Ubuntu Chrome After
Ubuntu 18.04 / Firefox  Drupal 8 CiviCRM 5 26 Ubuntu Firefox Before  Drupal 8 CiviCRM 5 26 Ubuntu Firefox After

This styling conflicts with CMS styles
@civibot
Copy link

civibot bot commented Mar 23, 2020

(Standard links)

@artfulrobot
Copy link
Contributor

Yes, I think this is the best and most maintainable approach. V grateful to @JGaunt for kicking this off though.

@wmortada wmortada changed the title (WIP) dev/wp#46 - Remove styling that attempts to make inputs match select2 dev/wp#46 - Remove styling that attempts to make inputs match select2 Apr 13, 2020
@wmortada
Copy link
Contributor Author

I've done lots of testing on this. The select element looks different across platforms but is usable in all the browser/OS combinations I have tested (Windows, Android and Ubuntu). I would appreciate some help testing on Safari and Chrome on Mac OS and iOS (though I don't anticipate any issues here).

@kcristiano
Copy link
Member

This does seem like a good compromise solution. Leaving the styling to the CMS works for this., I've tested on master against WP 5.3 and 5.4 with the same results detailed above.

@mattwire
Copy link
Contributor

Ping @JGaunt I think this is now ok? Would appreciate confirmation?

@wmortada
Copy link
Contributor Author

Thanks @kcristiano. Which browser/OS did you use to test this?

Keen to get some testing on Mac OS and iOS. I've got some demo sites that I set up if that would help with testing.

Would also be good to test in Drupal 8, Joomla and Backdrop to see what the impact is on these CMSs.

@kcristiano
Copy link
Member

I tested in Chromium and Firefox on linux with a WP site.
I agree it's tricky. I can test on all but iOS, I do agree with earlier comments that the theming should be more CMS centric. I'd like to see CiviCRM ship with alternate themes as extensions. Then the Org can choose which to use.

@demeritcowboy
Copy link
Contributor

demeritcowboy commented Apr 19, 2020

Shoreditch seems to do its own overrides so it doesn't change what it looks like there.

In Drupal 7 and 8 with the stock Bartik on its own it's fine. As you've noted it was inconsistent before anyway, so not a blocker, but noting for the record on firefox it's now more inconsistent in Drupal (windows 10).

BEFORE:

mailingbefore

AFTER:

mailing

@wmortada
Copy link
Contributor Author

@demeritcowboy thanks for doing some testing on this.

Yes, your experience with Firefox is consistent with my testing (see above). It is an unfortunate side effect of this PR that the appearance in Drupal is arguably worse. However, I can't see an easy way round this. Also important to note that the functionality isn't affected - it is still clearly a drop-down list and still functions correctly.

@wmortada
Copy link
Contributor Author

I've done some testing on Drupal 8 now. Results very similar to Drupal 7. I've added the results to the description.

I've also done a cursory check in Backdrop. Again very similar to Drupal 7.

I haven't been able to get Joomla running in buildkit so haven't tested with Joomla. Help with this welcome.

@kcristiano
Copy link
Member

kcristiano commented Apr 25, 2020

@wmortada

On Joomla - Chrome on ubuntu : After

image

If you want a login I do keep a Joomla RC test site running. Ping me in mattermost

@kcristiano
Copy link
Member

Further testing on Mac:

Safari - Drupal 7

image

Safari - Joomla 3.9

image

Safari - WP 5.4

image

Firefox - Drupal 7

image

Firefox - Joomla 3.9

image

Firefox - WP 5.4

image

Chrome - Drupal 7
image

Chrome - Joomla 3.9

image

Chrome - WP 5.4

image

@wmortada
Copy link
Contributor Author

@kcristiano thanks for all the testing!

It's interesting that the select element is covered by the drop down list on Mac (rather than below it). This makes it difficult to see how the select element is styled in your screenshots. I presume that you didn't spot any issues?

I feel like this has been extensively tested now. Are we happy for it to be merged?

@kcristiano
Copy link
Member

@wmortada you are corrrect! I kissed that it was covered. I'll get some more screen shots as soon as I have a chance.

I do think this improves WP and is neutral or better on Joomla and Drupal 7.

@kcristiano
Copy link
Member

Follow Up before select:

Firefox Drupal 7
image

Firefox Joomla

image
Firefox WP
image

Safari Joomla
image

Safari Drupal 7

image

Safari WP

image

Chrome Joomla
image

Chrome Drupal 7

image

Chrome WP
image

@mattwire mattwire merged commit 18d2b88 into civicrm:master Apr 27, 2020
@wmortada wmortada deleted the wp#46 branch April 28, 2020 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants