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

Improve datePicker placeholder/icons #15848

Merged
merged 1 commit into from
Nov 15, 2019
Merged

Conversation

colemanw
Copy link
Member

Overview

Small tweaks to the datepicker widget to improve flexibility & consistency.

Before

Inconsistent handling of the placeholder properties. FontAwesome font sometimes applied inappropriately. Time icon was applied conditionally but date icon would clobber any other icon specified.

After

Added a css class crm-placeholder-icon to abstract the idea of an input with a font icon as a placeholder. Apply that class only if we're using an icon and not some other placeholder.

@civibot
Copy link

civibot bot commented Nov 14, 2019

(Standard links)

@civibot civibot bot added the master label Nov 14, 2019
@colemanw
Copy link
Member Author

@agh1 this one is pretty straightforward to review. Shouldn't impact existing screens but improves flexibility with an eye toward form-builder.

@agh1 agh1 self-assigned this Nov 15, 2019
Copy link
Contributor

@agh1 agh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • General standards

    • (r-explain) PASS

    • (r-user) PASS: it should be unnoticeable

    • (r-doc) PASS: however, it would be nice to have some notes in the developer docs saying you can give a field the attribute placeholder or time-placeholder to specify a different placeholder

    • (r-run) ISSUE: it appears that the input lacks the crm-placeholder-icon class which the CSS selects for and instead has the class crm-placeholder-right. That results in the placeholder being the wrong font and not aligned to the right. I suspect that you changed your mind about what it should be called, and as long as the element and the CSS have the same class you'll be fine.

      New event - WordPress - Firefox - master:
      image

      New event - WordPress - Firefox - with this merged:
      image

  • Developer standards

.crm-container input.dateplugin::placeholder,
.crm-container input.crm-form-date::placeholder,
.crm-container input.crm-form-time::placeholder {
.crm-container input.crm-placeholder-icon::placeholder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be crm-placeholder-right here and below.

Suggested change
.crm-container input.crm-placeholder-icon::placeholder {
.crm-container input.crm-placeholder-right::placeholder {

Also, are there three separate blocks because IE needs it to be that way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to what I've read, all the major browsers support ::placeholder except MS is still lagging behind, and also inconsistent about which one of the two brand-prefixes it wants.

.change(updateDataField)
.timeEntry({
spinnerImage: '',
show24Hours: settings.time === true || settings.time === undefined ? CRM.config.timeIs24Hr : settings.time == '24'
});
if (!placeholder) {
$timeField.addClass('crm-placeholder-right');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could instead switch this (and the spot on line 82) to crm-placeholder-icon to match the CSS, but I like having -right in the class to be clear that we're aligning it to the right. I suppose if you want to be real fancy you could set two classes: crm-placeholder-icon that sets it to be Font Awesome and crm-placeholder-right that aligns the placeholder to the right.

@agh1 agh1 removed their assignment Nov 15, 2019
@colemanw
Copy link
Member Author

Thanks for the review @agh1. Good catch, I did change my mind mid-commit because I think crm-placeholder-icon is more descriptive. Separating it into two classes is probably overkill. I think this is good to go now.

@colemanw colemanw merged commit e3e4824 into civicrm:master Nov 15, 2019
@colemanw colemanw deleted the dateIcons branch November 15, 2019 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants