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 display of checkboxes in Internet Explorer 8 #2228

Merged
merged 2 commits into from
May 17, 2021
Merged

Conversation

36degrees
Copy link
Contributor

@36degrees 36degrees commented May 14, 2021

We use the before and after pseudo-elements on the label for checkboxes to provide stylised checkboxes in modern browsers.

Internet Explorer 8 (IE8) does not support some of the features we use to do this, so we ‘fall back’ to the native HTML inputs instead.

In 09ef79d we updated the before and after pseudo-elements in the checkboxes sass to use a single colon, which was newly enforced as part of a switch to stylelint.

IE8 only supports the single-colon syntax, and it looks like we were actually relying on the double-colon syntax not being interpreted by IE8 in order to prevent them being displayed in that browser.

As a result, changing to a single-colon means that IE8 now interprets the pseudo-selectors, and as a result ends up with a malformed checkmark visible next to the native HTML input.

Wrap the before and after pseduo-elements with the @govuk-not-ie8 mixin to exclude these rules from being included in the IE8 specific stylesheet.

Before

Screenshot 2021-05-14 at 11 00 42

After

Screenshot 2021-05-14 at 11 00 46

Fixes #2227

We use the `before` and `after` pseudo-elements on the label for checkboxes to provide stylised checkboxes in modern browsers.

Internet Explorer 8 does not support some of the features we use to do this, so we ‘fall back’ to the native HTML inputs instead.

In 09ef79d we updated the before and after pseudo-elements in the checkboxes sass to use a single colon, which was newly enforced as part of a switch to stylelint.

IE8 only supports the single-colon syntax [1], and it looks like we were actually relying on the double-colon syntax _not_ being interpreted by IE8 in order to prevent them being displayed in that browser.

As a result, changing to a single-colon means that IE8 now interprets the pseudo-selectors, and as a result ends up with a malformed checkmark visible next to the native HTML input.

Wrap the before and after pseduo-elements with the @govuk-not-ie8 mixin to exclude these rules from being included in the IE8 specific stylesheet.

[1]: https://caniuse.com/css-gencontent
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2228 May 14, 2021 10:01 Inactive
Copy link
Member

@lfdebrux lfdebrux left a comment

Choose a reason for hiding this comment

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

Works for me with the review app and BrowserStack IE8. Also checked the checkboxes in Chrome on macOS to confirm there was no change there.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2228 May 17, 2021 09:22 Inactive
@36degrees 36degrees merged commit c14d6c9 into main May 17, 2021
@36degrees 36degrees deleted the checkboxes-ie8 branch May 17, 2021 10:38
@lfdebrux lfdebrux mentioned this pull request Jun 24, 2021
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.

Checkboxes display incorrectly in IE8
3 participants