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

Fix focus outline style in Chrome and Safari #414

Merged
merged 3 commits into from
Jan 8, 2018
Merged

Conversation

36degrees
Copy link
Contributor

Chrome and Safari set outline-offset to -2px for focussed textareas, selects and inputs, so we need to reset to 0 so that the outline appears consistently outside of the border rather than overlaying it.

As part of this, move the focus style into a helper to avoid defining the focus style in multiple places.

https://trello.com/c/GwwOrcyB/539-focus-outline-style-should-be-offset-from-border-not-overlapping

Input

input-before

input-after

Textarea

textarea-before

textarea-after

Select

No change - the select focus state already included outline-offset: 0

select-before

select-after

Error Summary (no change)

No change - the user agent stylesheet does not set outline-offset for the focus state of a div.

error-summary-before

error-summary-after

File Upload (no change)

No change - the user agent stylesheet already resets outline-offset to 0 for the focus state of a input of type file.

file-upload-before

file-upload-after

This gives us a single place to define how focusable form elements should behave when focussed.

Chrome and Safari set outline-offset to -2px for focussed textareas, selects and inputs, so we need to reset to 0 so that the outline appears consistently outside of the border rather than overlaying it.
Copy link
Contributor

@alex-ju alex-ju left a comment

Choose a reason for hiding this comment

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

💯 tested and works well; code looks good too.
thanks for that, it 👾 ed me for a while

@36degrees 36degrees merged commit 2f89f82 into master Jan 8, 2018
@36degrees 36degrees deleted the fix-focus-outline branch January 8, 2018 14:52
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.

3 participants