[Footer]: Fix footer social icon hit area - flexible#1262
Conversation
## 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.
|
@maya and @ericadeahl - What SVG compiler are you using - I see the SVG generated for this is huge compared to what it was. |
|
I like this approach a lot. FWIW, I think that the inline SVGs could have been sized in CSS and the |
| margin-left: $blank-space; | ||
| position: relative; | ||
| text-align: center; | ||
| width: $hit-area; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I generally agree, but I think that the $hit-area variable is helpful here. @joshbruce maybe move the comments alongside the properties instead?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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.
|
Hey @joshbruce. Looks like you'll need to rebase this branch onto the latest work on |
…n-hit-area-flexible
|
@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. |
|
@joshbruce looking at the branch, this is what it looks like: This is what it's supposed to look like: @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"); | ||
| } |
There was a problem hiding this comment.
Add one line-break here. All of our files should have an extra space at the end of the file.
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
It must be a github thing, just checked this out locally and looks correct. 👍
|
@maya - Odd. Here's what I see: The screenshot is from Safari 9.1.1 on the macOS 10.11.5. The next one is from Chrome 51 Thoughts? |
|
@joshbruce was on the wrong branch, my bad! Looks like your screenshots :) |
|
@joshbruce on mobile, the alignment looks like it's indented to the right, could we align this flush left? Should be: |
|
@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. 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. |
|
@maya - Sorry - forgot the spacing between the icons on top and bottom - should be good now. |
|
Looks good! |
|
Woohoo, thanks @joshbruce! |










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:
width per link - in two areas (once for the
svgelement and the otherfor the
imageelement).lines to define the link.
container
.usa-social-links, which has no definition outside ofdefining each
aelement within the container.This PR:
.usa-social-linkscontainer.div..usa-social-linkclass for defining global attributes (hitarea, for example); allowing any link to become a social link.
.facebook,.twitter,.youtube, and.rssclasses, whichmust be used in conjunction with
.usa-social-linkto take effect.extenders, without having to define dimensions and layouts.