Skip to content

[Footer]: Fix footer social icon hit area - flexible#1262

Merged
maya merged 13 commits into
uswds:stagingfrom
joshbruce:fix-footer-social-icon-hit-area-flexible
Jun 23, 2016
Merged

[Footer]: Fix footer social icon hit area - flexible#1262
maya merged 13 commits into
uswds:stagingfrom
joshbruce:fix-footer-social-icon-hit-area-flexible

Conversation

@joshbruce

@joshbruce joshbruce commented Jun 16, 2016

Copy link
Copy Markdown

Description

Alternative #1248
Fixes #346

Additional information

#1248 updates the size of the social link icons, and adds a hit area

around the links to make them more mobile friendly. Visually, the links
are smaller; however, the active area of the link is larger (~45px
square).

Things I noticed from creating #1248:

  • Changing icon sizes ([Footer] design update #706) requires manually changing the height and
    width per link - in two areas (once for the svg element and the other
    for the image element).
  • Adding a new icon (LinkedIn, for example), requires adding 6 new
    lines to define the link.
  • The CSS definition assumes all social links need to be held within a
    container .usa-social-links, which has no definition outside of
    defining each a element within the container.

This PR:

  1. Re-engineers social icons as background images.
  2. Removes dependency on .usa-social-links container.
  3. Removes containing div.
  4. Adds .usa-social-link class for defining global attributes (hit
    area, for example); allowing any link to become a social link.
  5. Adds .facebook, .twitter, .youtube, and .rss classes, which
    must be used in conjunction with .usa-social-link to take effect.
  6. Allows for introduction of more background for social media links by
    extenders, without having to define dimensions and layouts.

Josh Bruce added 6 commits May 27, 2016 10:44
## Description

Fixes #346

## Additional information

* This PR uses `display: inline-block` to allow setting height and
width to an inline element.
* Uses 44 pixels for both height and width per the Apple iOS HIG
* Concerns with `text-align: right` - could result in thumb hitting to
the right of the hit area - actually hitting the icon to the right of
the actual target. `text-align: center` used instead.
* Using `text-align: center` causes the right alignment of the icons to
be off when compared “Agency Contact Center” text. `position: relative;
left: 13px` used in order to compensate. Slight concern that this could
cause a horizontal scroll bar to appear on mobile - though, given the
overall alignment of the `social-links` container - concern may be moot.
- changed icon base sizes
- made 2x for high-density displays
- converted to rem
- hit area larger than 44px
## Description

Alternative #1248

## Additional information

#1248 updates the size of the social link icons, and adds a hit area
around the links to make them more mobile friendly. Visually, the links
are smaller; however, the active area of the link is larger (~45px
square).

Things I noticed from creating #1248:

- Changing icon sizes (#706) requires manually changing the height and
width per link - in two areas (once for the `svg` element and the other
for the `image` element).
- Adding a new icon (LinkedIn, for example), requires adding 6 new
lines to define the link.
- The CSS definition assumes all social links need to be held within a
container `.usa-social-links`, which has no definition outside of
defining each `a` element within the container.

This PR:

1. Re-engineers social icons as background images.
2. Removes dependency on `.usa-social-links` container.
3. Removes containing `div`.
4. Adds `.usa-social-link` class for defining global attributes (hit
area, for example); allowing any link to become a social link.
5. Adds `.facebook`, `.twitter`, `.youtube`, and `.rss` classes, which
must be used in conjunction with `.usa-social-link` to take effect.
6. Allows for introduction of more background for social media links by
extenders, without having to define dimensions and layouts.

This is a branch from a branch (could not get the image updates from
#1248 in here - possibly a knowledge gap on my part); therefore, if we
would like to go this route, I should be able to merge this into the
other to update #1248…at which point, this PR can be closed without
merging.
@joshbruce

Copy link
Copy Markdown
Author

@maya and @ericadeahl - What SVG compiler are you using - I see the SVG generated for this is huge compared to what it was.

@joshbruce

Copy link
Copy Markdown
Author

screen shot 2016-06-16 at 1 08 05 pm

screen shot 2016-06-16 at 1 08 10 pm

@joshbruce joshbruce changed the title Fix footer social icon hit area flexible [Footer]: Fix footer social icon hit area - flexible Jun 16, 2016
@shawnbot

Copy link
Copy Markdown
Contributor

I like this approach a lot. FWIW, I think that the inline SVGs could have been sized in CSS and the <image> elements given width="100%" height="100%" to solve the redundant dimensions issue. This approach is even cleaner, though, and requires a lot less markup for users to implement, which is always a good thing.

margin-left: $blank-space;
position: relative;
text-align: center;
width: $hit-area;

@maya maya Jun 17, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we need variables. We only use variables if the value is repeated at least twice and the value is likely to be updated at least once. Can you remove?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I generally agree, but I think that the $hit-area variable is helpful here. @joshbruce maybe move the comments alongside the properties instead?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hmmmm...either way is fine for me.

The initial reason - specifically for the hit area one is actually because, according to the CSS coding style, I couldn't put width and height next to each other alphabetically. The other two came about just to further separate the static values from the implementation - OOP-style.

Again, I'm fine for whichever.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm OK with keeping $hit-area for that reason, but would remove the rest.

Can we add a more descriptive comment on it:

Link hit target is 44 x 44 pixels following Apple iOS Human Interface Guidelines

Josh Bruce added 2 commits June 17, 2016 18:47
Added a background-height variable - which could make future changes
easier should we change the height and width of the links or changing
the proportional height of the background icon.
@rogeruiz

Copy link
Copy Markdown
Contributor

Hey @joshbruce. Looks like you'll need to rebase this branch onto the latest work on staging. #1261 has removed screener and that will get this PR to pass in CircleCI. If it's helpful, I can rebase these changes manually and submit a new pull request with that update. Thanks!

@joshbruce

Copy link
Copy Markdown
Author

@rogeruiz - Thanks. Saw the traffic and wasn't sure. Will push in two seconds and see what happens.

Might need some follow-on help, if you're up to it.

@maya

maya commented Jun 21, 2016

Copy link
Copy Markdown
Contributor

@joshbruce looking at the branch, this is what it looks like:

screen shot 2016-06-21 at 9 27 58 am

This is what it's supposed to look like:

screen shot 2016-06-21 at 9 29 35 am

@ericadeahl posted sizes for the icons in #1248 (comment) although they all appear to be the same 29px x 29px here.

@extend .usa-social_link;
background-image: url("../img/social-icons/png/rss25.png");
background-image: url("../img/social-icons/svg/rss25.svg");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add one line-break here. All of our files should have an extra space at the end of the file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@maya - I'm not sure why the blank line is not showing in the diff...? I added periods to the comments in order to get this commit to work. My file shows 350 line long.

Thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It must be a github thing, just checked this out locally and looks correct. 👍

@joshbruce

Copy link
Copy Markdown
Author

@maya - Odd. Here's what I see:

screen shot 2016-06-21 at 12 45 56 pm

The screenshot is from Safari 9.1.1 on the macOS 10.11.5.

The next one is from Chrome 51

screen shot 2016-06-21 at 12 52 14 pm

Thoughts?

@maya

maya commented Jun 21, 2016

Copy link
Copy Markdown
Contributor

@joshbruce was on the wrong branch, my bad! Looks like your screenshots :)

@maya

maya commented Jun 21, 2016

Copy link
Copy Markdown
Contributor

@joshbruce on mobile, the alignment looks like it's indented to the right, could we align this flush left?

screen shot 2016-06-21 at 10 06 35 am

Should be:

screen shot 2016-06-21 at 10 10 58 am

@joshbruce

Copy link
Copy Markdown
Author

@maya - Good catch - sorry about that.

Not quite an exact match - mainly because I don't think the "should be" image accounts for the margin and increased height and width. Having said that, the spacing is consistent with the medium screen.

screen shot 2016-06-21 at 3 10 51 pm

Would you be willing to school me on how you managed to see the branch from this PR? I was trying to that with my program's standards the other day and could not get it to show up.

@joshbruce

Copy link
Copy Markdown
Author

@maya - Sorry - forgot the spacing between the icons on top and bottom - should be good now.

screen shot 2016-06-21 at 3 37 11 pm

@maya

maya commented Jun 23, 2016

Copy link
Copy Markdown
Contributor

Looks good!

@maya maya merged commit 29aac95 into uswds:staging Jun 23, 2016
@shawnbot

Copy link
Copy Markdown
Contributor

Woohoo, thanks @joshbruce!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants