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

feat: remove support for internet explorer #1807

Merged
merged 10 commits into from
Dec 19, 2022
Merged
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"node-gyp": "8.4.0"
},
"resolutions": {
"svg2vectordrawable/svgo": "2.3.0",
"@storybook/preset-ie11@0.0.1": "patch:@storybook/preset-ie11@npm:0.0.1#.yarn/patches/@storybook-preset-ie11-npm-0.0.1-f80c765898"
"svg2vectordrawable/svgo": "2.3.0"
},
"engines": {
"node": "14.17.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/dnb-design-system-portal/.browserslistrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Should reflect: https://eufemia.dnb.no/uilib/usage#supported-browsers-and-platforms
ie 11
edge >= 14
firefox >= 52
chrome >= 49
safari >= 10
safari >= 10
not ie > 0
not ie_mob > 0
4 changes: 0 additions & 4 deletions packages/dnb-design-system-portal/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,4 @@ module.exports = {
},
],
],
ignore: [
// Needed in order to run on IE11
'.*node_modules/(?!rewrite-pattern|ansi-regex|strip-ansi|regexpu-core|buble|react-live).*',
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The reason why there are two sizes, is mainly due to the SVG artifact, that the

### Scalability in web

To ensure that the relative size of the SVG icons is scalable by the inherited CSS font size, do not explicitly specify the SVG, unless for older browsers like Internet Explorer.
To ensure that the relative size of the SVG icons is scalable by the inherited CSS font size, do not explicitly specify the SVG.

**Example size definition by CSS**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ v10 of @dnb/eufemia contains _breaking changes_. As a migration process, you can

1. New **Definition List** layout direction: `direction="horizontal"` including `Dl.Item` [demo](https://eufemia.dnb.no/uilib/elements/lists/#definition-list-in-horizontal-direction).

### [Stopped supporting Internet Explorer (IE)](/uilib/usage/#supported-browsers-and-platforms)

Stopped supporting Internet Explorer (IE), as Microsoft formally ended support for IE in June, 2022.

### Deprecations

- `use_scrollwheel` and `on_init` properties, as well as the `raw_value` event value from [Slider](/uilib/components/slider) was removed in order to support multiple buttons.
- Helper class `.dnb-sr-only--inline` and SCSS mixin `srOnlyInline` was removed.
- Helper class `.dnb-not-sr-only` and SCSS mixin `notSrOnly` was removed.
- `isIE11` and `IS_IE11` is deprecated as we have stopped supporting Internet Explorer (IE).

## Install

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ redirect_from:
| `value` or `children` | _(required)_ a number. |
| `srLabel` | _(optional)_ Will add a visually hidden label to give screen reader users the missing context to understand easier what the number represents. |
| `locale` | _(optional)_ Use a [2 Letter Language Codes](https://www.sitepoint.com/iso-2-letter-language-codes/) or an extended code such as `nb-NO`. Use `auto` to detect the locale from the browser (`navigator.language`). Defaults to the Norwegian locale: `nb-NO`. |
| `compact` | _(optional)_ Shortens any number or currency including an abbreviation (no IE11 support). You can combine `compact` with `currency`. It gives you zero decimal by default `decimals={0}`. Use either `short` or `long`. Defaults to `short` if `true` is given. |
| `compact` | _(optional)_ Shortens any number or currency including an abbreviation. You can combine `compact` with `currency`. It gives you zero decimal by default `decimals={0}`. Use either `short` or `long`. Defaults to `short` if `true` is given. |
| `clean` | _(optional)_ if set to `true` a dirty string will be parsed to to extract the number (`prefix -123.45 suffix` would result in e.g. `kr -123,45`). |
| `currency` | _(optional)_ Currency code (ISO 4217) or `true` to use the default `NOK`. Uses two decimals by default. |
| `currency_display` | _(optional)_ Use either empty/false to hide the sign/name or use `code` (NOK), `name` (norske kroner) , `symbol` (kr) or `narrowSymbol` (for a shorter symbol variant). Defaults to `narrowSymbol` when the locale is `no` else we default to `code`. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,3 @@ const { InfinityMarker, endInfinity, resetInfinity } =

render(<InfinityMarker>ReactComponent</InfinityMarker>)
```

### Legacy browser support (Internet Explorer 11)

The **infinity scroller** is using the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API). This API is supported by all nowadays browsers. But if your applications need support for outdated browser, you can install e.g. [this IntersectionObserver polyfill](https://www.npmjs.com/package/intersection-observer) and import it:

```js
import 'intersection-observer'
```
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ If you only want to change the colors, you can swap out `fill='%23007272'` with
}
```

To ensure compatibility for Internet Explorer and older Edge versions, you may still use **base64**. Use e.g. [this base64 converter](https://www.base64encode.org)
To ensure compatibility for older Edge versions, you may still use **base64**. Use e.g. [this base64 converter](https://www.base64encode.org)

```css
.dnb-anchor::after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ You can import Eufemia _mixins_ directly into your SCSS styles:
} // .dnb-sr-only--inline

/** Browser Checks */
@include IS_IE {
}
@include IS_EDGE {
}
@include IS_FF {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ copyToClipboard(string) // returns success: String|Boolean|Error

| Function | Description | Parameters | Return |
| ---------- | -------------------------------------------------- | ---------- | --------- |
| `isIE11` | Returns true or false, depending on the detection. | none | `Boolean` |
| `isEdge` | Returns true or false, depending on the detection. | none | `Boolean` |
| `isSafari` | Returns true or false, depending on the detection. | none | `Boolean` |
| `isiOS` | Returns true or false, depending on the detection. | none | `Boolean` |
Expand All @@ -290,7 +289,6 @@ copyToClipboard(string) // returns success: String|Boolean|Error

| Constant | Description | Value |
| ----------- | ------------------------------------------------------------------- | --------- |
| `IS_IE11` | Gives you true or false, depending on the detection during startup. | `Boolean` |
| `IS_EDGE` | Gives you true or false, depending on the detection during startup. | `Boolean` |
| `IS_SAFARI` | Gives you true or false, depending on the detection during startup. | `Boolean` |
| `IS_IOS` | Gives you true or false, depending on the detection during startup. | `Boolean` |
Expand Down
6 changes: 3 additions & 3 deletions packages/dnb-design-system-portal/src/docs/uilib/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ Read more in the [First Steps](/uilib/usage/first-steps/) section.

## Supported Browsers and Platforms

| IE | Edge | Firefox | Chrome | Safari | Node |
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
| <small>==</small> 11 | <small>>=</small> 14 | <small>>=</small> 45 | <small>>=</small> 49 | <small>>=</small> 10 | <small>>=</small> 10 |
| Edge | Firefox | Chrome | Safari | Node |
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
| <small>>=</small> 14 | <small>>=</small> 45 | <small>>=</small> 49 | <small>>=</small> 10 | <small>>=</small> 10 |
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ title: 'Polyfill'

By using Eufemia properties, like [color names](/uilib/usage/customisation/colors) and [typography properties](/uilib/typography), instead of defining colors and typography directly as hard coded values, you make your code much more readable and future proof in terms of refactoring and new enhancements. [Maintainability](/uilib/getting-started/maintainability) is important. But it fits also better in thinking of the [Living system](/uilib/getting-started/living-system) terms.

But as long as we have to support legacy browsers like [Internet Explorer](!/uilib/usage#supported-browsers-and-platforms) we have to deal with a fallback or polyfill.

## Post CSS

Use [postcss-preset-env](https://github.com/csstools/postcss-preset-env). Example [webpack](https://webpack.js.org) loader config:
Expand All @@ -22,7 +20,7 @@ Use [postcss-preset-env](https://github.com/csstools/postcss-preset-env). Exampl
postcssPresetEnv({
stage: 0,
preserve: true,
browsers: ['last 2 versions', 'explorer >= 11'],
browsers: ['last 2 versions', 'not ie > 0', 'not ie_mob > 0'],
importFrom: [require.resolve('@dnb/eufemia/style/dnb-ui-properties.css')]
})
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ If your applications only need new colors or other CSS properties, you could sim

### Using CSS (vars) Custom Properties

This is for sure a very nice and powerful solution, but lacks Internet Explorer support.
This is a very nice and powerful solution.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ import Button from '@dnb/eufemia/es/components/Button'
Make sure your environment has a production build with:

- Tree Shaking
- Compile to ES5 for IE support
- Minify and mangle the Output

By default, [webpack v4](https://webpack.js.org) does this fine.
Expand Down
26 changes: 3 additions & 23 deletions packages/dnb-design-system-portal/src/shared/menu/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import React from 'react'
import PropTypes from 'prop-types'
import Link from 'gatsby-link'
import { Button } from '@dnb/eufemia/src'
import { IS_IE11 } from '@dnb/eufemia/src/shared/helpers'
import classnames from 'classnames'
import { P, Span } from '@dnb/eufemia/src/elements'
import {
Expand Down Expand Up @@ -36,33 +35,14 @@ export default class Card extends React.PureComponent {
render() {
const { url, title, about, icon: Svg } = this.props

// size is else defined in css
const svgParams = IS_IE11 ? { width: '48', height: '48' } : null

const Anchor = IS_IE11
? ({ children, to, ...rest }) =>
to && (
<a
{...rest}
href={url}
onClick={(event) => {
event.preventDefault()
window.location.assign(url)
}}
>
{children}
</a>
)
: Link

return (
<li
className={classnames(
liItemStyle,
this.isSelected() && 'is-selected'
)}
>
<Anchor
<Link
className={classnames(
linkStyle,
'dnb-anchor--no-style',
Expand All @@ -73,7 +53,7 @@ export default class Card extends React.PureComponent {
>
<Span className={linkInnerStyle}>
<Span className={boxStyle}>
{Svg && <Svg {...svgParams} />}
{Svg && <Svg />}
<P style_type="lead">{title}</P>
<P top="x-small">{about}</P>
</Span>
Expand All @@ -88,7 +68,7 @@ export default class Card extends React.PureComponent {
/>
</Span>
</Span>
</Anchor>
</Link>
</li>
)
}
Expand Down
12 changes: 0 additions & 12 deletions packages/dnb-design-system-portal/src/shared/menu/Card.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,6 @@
transform: scale3d(0.9, 0.9, 1) translate3d(0, -8%, 0);
}
}

/* IE11 fix */
@media screen and (-ms-high-contrast: none) {
&.show-cards {
opacity: 1;
}
overflow: hidden;
background-color: #fff;
p {
width: 20rem;
}
}
}

.linkStyle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

background-color: transparent;
transition: background-color ease-out 0.8s;

/* IE11 fix */
@media screen and (-ms-high-contrast: none) {
background-color: var(--color-emerald-green);
}
}

.listStyle {
Expand All @@ -42,12 +37,6 @@
justify-content: center;
align-items: center;

/* IE11 fix */
@media screen and (-ms-high-contrast: none) {
width: auto;
color: #fff;
}

@include allBelow(small) {
.dnb-drawer-list__list {
width: 90vw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
:global {
:root {
--aside-width: calc(25vw + 5rem);

@include IS_IE {
--aside-width: 30vw;
}
}

.dnb-sidebar-menu {
Expand Down
3 changes: 2 additions & 1 deletion packages/dnb-eufemia/.browserslistrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ie 11
edge >= 14
firefox >= 52
chrome >= 49
safari >= 10
not ie > 0
not ie_mob > 0
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
builder: 'webpack5',
},
stories: ['../src/**/*.stories.{js,tsx}'],
addons: ['@storybook/preset-ie11', '@storybook/preset-scss'],
addons: ['@storybook/preset-scss'],
}
1 change: 0 additions & 1 deletion packages/dnb-eufemia/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const config = {
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-object-assign', // for IE support
],
sourceMaps: true,
comments: false,
Expand Down
2 changes: 0 additions & 2 deletions packages/dnb-eufemia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-syntax-typescript": "7.16.0",
"@babel/plugin-transform-modules-commonjs": "7.16.0",
"@babel/plugin-transform-object-assign": "7.16.0",
"@babel/plugin-transform-react-constant-elements": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.0",
"@babel/preset-env": "7.16.0",
Expand All @@ -146,7 +145,6 @@
"@storybook/addons": "6.5.12",
"@storybook/builder-webpack5": "^6.5.12",
"@storybook/manager-webpack5": "^6.5.12",
"@storybook/preset-ie11": "patch:@storybook/preset-ie11@0.0.1#../../.yarn/patches/@storybook-preset-ie11-npm-0.0.1-f80c765898",
"@storybook/preset-scss": "1.0.3",
"@storybook/react": "6.5.12",
"@storybook/theming": "6.5.12",
Expand Down
35 changes: 3 additions & 32 deletions packages/dnb-eufemia/scripts/prebuild/config/postcssConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const sassBin = require('sass')
const os = require('os')
const path = require('path')

module.exports = ({ IE11 = false, sass = sassBin, ...options } = {}) => {
module.exports = ({ sass = sassBin, ...options } = {}) => {
return [
// preset-env processes the most of our old legacy browsers
require('postcss-preset-env')({
stage: IE11 ? 0 : 2,
stage: 2,
preserve: true, // so we get the calc from vars, to process for IE11 later with "postcss-calc"
browsers: ['last 2 versions', IE11 ? 'explorer >= 11' : null].filter(
browsers: ['last 2 versions', 'not ie > 0', 'not ie_mob > 0'].filter(
(i) => i
),
importFrom: [
Expand All @@ -27,35 +27,6 @@ module.exports = ({ IE11 = false, sass = sassBin, ...options } = {}) => {
],
...options,
}),

// but for IE11, we also calculate all left over calc, and remove the originals
IE11
? require('postcss-calc')({
// "preserve: true" will keep both the calculation version, the calc() and the variable (if available)
// but as we only use postcss-calc on IE11, it is kind of not needed, so we remove then the calc()
/*
border-radius: 1.25rem;
border-radius: calc(2.5rem / 2);
border-radius: var(--button-border-radius);
*/
preserve: true,
warnWhenCannotResolve: false,
})
: null,

// In case we want to have all the plugins by their self
// IE11
// ? require('postcss-custom-properties')({
// preserve: true,
// // importFrom: ['path/to/file.css'],
// ...options
// })
// : null,
// require('autoprefixer')({
// browsers: ['last 2 versions', IE11 ? 'explorer >= 11' : null].filter(
// i => i
// )
// })
].filter((i) => i)
}

Expand Down
7 changes: 1 addition & 6 deletions packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ export const runFactory = (
transformPaths('../../../../assets/', '../../../assets/')
)
)
.pipe(
transform(
'utf8',
transformPostcss(postcssConfig({ IE11: true, sass }))
)
)
.pipe(transform('utf8', transformPostcss(postcssConfig({ sass }))))
.pipe(cloneSink)
.pipe(transform('utf8', transformCssnano({ reduceIdents: false })))
.pipe(rename({ suffix: '.min' }))
Expand Down
7 changes: 1 addition & 6 deletions packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ export const runFactory = (
extname: '.css',
})
)
.pipe(
transform(
'utf8',
transformPostcss(postcssConfig({ IE11: true, sass }))
)
)
.pipe(transform('utf8', transformPostcss(postcssConfig({ sass }))))
.pipe(cloneSink)
.pipe(transform('utf8', transformCssnano({ reduceIdents: false })))
.pipe(rename({ suffix: '.min' }))
Expand Down
Loading