-
Notifications
You must be signed in to change notification settings - Fork 336
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
New start button icon #1329
New start button icon #1329
Conversation
Ordering of :focus and :hover pseudo selectors are important to ensure focus replaces the hover state. The scenario is where a user might decide to use keyboard nagivation and the mouse is left hovered over the button. The button should use the focus state and not the hover state
src/components/button/template.njk
Outdated
@@ -10,9 +21,14 @@ | |||
{% endif %} | |||
{% endif %} | |||
|
|||
{% if params.isStartButton %} | |||
{% set iconMarkUp = '<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="19px" width="30px"><path fill="currentColor" d="M7.5 0H0l10 10L0 20h7.5l10-10-10-10z"/></svg>' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can improve the inline SVG by doing the following:
- remove 'data-name' attribute as it's not needed.
- add
.govuk-button__icon
class instead of styling the 'svg' element, this'll make sure if anyone else wants to put svg icons into this button we won't style theirs unintentionally. - change
height
andwidth
to be relative units (em
), this'll make the icon scale alongside the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First two points have been done.
@include govuk-device-pixel-ratio { | ||
background-image: govuk-image-url("icon-pointer-2x.png"); | ||
background-size: 30px 19px; | ||
@include govuk-media-query($until: tablet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this with a breakpoint?
@fofr yep :) |
@@ -10,9 +21,14 @@ | |||
{% endif %} | |||
{% endif %} | |||
|
|||
{% if params.isStartButton %} | |||
{% set iconMarkUp = '<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="19px" width="30px"><path fill="currentColor" d="M7.5 0H0l10 10L0 20h7.5l10-10-10-10z"/></svg>' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if we need focusable=false
on internet explorer here, since SVGs can be added to the tab order mistakenly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this in IE and it doesn't appear to be an issue. I think this might because the svg is already in a focusable element like a
and button
Closing in favour of #1341 |
Replacing two tones png file for an inline SVG.
Before
After
👉 Demo
TODO: