Situation and problem description
I'm currently working on mobile optimization of a web page according to hints given from Google Developer's PageSpeed Insights Tool and I get a lot of warnings about tap targets being too close to each other. The problem is: PageSpeed sees multiple tap targets when there's just one intended to be.
Example
PageSpeed Output (simplyfied):
The tap target <span class="glyphicon"> is close to 1 other tap targets. The tap target <span class="badge"> is close to 1 other tap targets.
corresponding CSS/HTML (simplified):
.glyphicon::before { content: "x"; /* substitute for same size shopping cart symbol of custom font*/ } .badge { background-color: #999; border-radius: 10px; color: #fff; display: inline-block; font-size: 12px; font-weight: 700; line-height: 1; min-width: 10px; padding: 3px 7px; text-align: center; vertical-align: baseline; } a { text-decoration: none; border-color: #000; border-radius: 3px; border-style: solid; border-width: 1px; margin: 1px 2px; padding: 5px 8px; }
<a href="//some.where"> <span class="glyphicon"></span> <span class="badge">21</span> </a>
Question
You can see easily that the intention is to have one tap target which is the link, consisting of two (or in similar cases more) HTML elements.
What can I do to make Google's PageSpeed to recognize just the parenting link for a tap target and ignore it's children?