Merge pull request #1588 from ing-bank/fix/remove-differentKeyEventNamesShimIE
chore: remove differentKeyEventNamesShimIE
This commit is contained in:
commit
881e1c6de2
23 changed files with 23 additions and 138 deletions
6
.changeset/chilly-poets-march.md
Normal file
6
.changeset/chilly-poets-march.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
'@lion/core': minor
|
||||||
|
'@lion/calendar': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove keyboardEventShimIE test helper
|
||||||
10
.changeset/six-vans-rhyme.md
Normal file
10
.changeset/six-vans-rhyme.md
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
'@lion/button': minor
|
||||||
|
'@lion/calendar': minor
|
||||||
|
'@lion/core': minor
|
||||||
|
'@lion/listbox': minor
|
||||||
|
'@lion/overlays': minor
|
||||||
|
'@lion/select-rich': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove differentKeyEventNamesShimIE, since IE11 isn't supported any more
|
||||||
6
.changeset/spotty-zebras-sip.md
Normal file
6
.changeset/spotty-zebras-sip.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
'@lion/core': minor
|
||||||
|
'@lion/listbox': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove closestPolyfill
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { browserDetection, css, DisabledWithTabIndexMixin, html, LitElement } from '@lion/core';
|
import { browserDetection, css, DisabledWithTabIndexMixin, html, LitElement } from '@lion/core';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
|
|
||||||
const isKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ' || e.key === 'Enter';
|
const isKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ' || e.key === 'Enter';
|
||||||
const isSpaceKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ';
|
const isSpaceKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
/* eslint-disable lit-a11y/click-events-have-key-events */
|
/* eslint-disable lit-a11y/click-events-have-key-events */
|
||||||
import { LionButton } from '@lion/button';
|
import { LionButton } from '@lion/button';
|
||||||
import { browserDetection } from '@lion/core';
|
import { browserDetection } from '@lion/core';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import {
|
import {
|
||||||
aTimeout,
|
aTimeout,
|
||||||
defineCE,
|
defineCE,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
/* eslint-disable lit-a11y/click-events-have-key-events */
|
/* eslint-disable lit-a11y/click-events-have-key-events */
|
||||||
import { LionButtonReset } from '@lion/button';
|
import { LionButtonReset } from '@lion/button';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
/* eslint-disable lit-a11y/click-events-have-key-events */
|
/* eslint-disable lit-a11y/click-events-have-key-events */
|
||||||
import { LionButtonSubmit } from '@lion/button';
|
import { LionButtonSubmit } from '@lion/button';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
||||||
import { sendKeys } from '@web/test-runner-commands';
|
import { sendKeys } from '@web/test-runner-commands';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import {
|
||||||
normalizeDateTime,
|
normalizeDateTime,
|
||||||
} from '@lion/localize';
|
} from '@lion/localize';
|
||||||
|
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { calendarStyle } from './calendarStyle.js';
|
import { calendarStyle } from './calendarStyle.js';
|
||||||
import { createDay } from './utils/createDay.js';
|
import { createDay } from './utils/createDay.js';
|
||||||
import { createMultipleMonth } from './utils/createMultipleMonth.js';
|
import { createMultipleMonth } from './utils/createMultipleMonth.js';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { html } from '@lion/core';
|
import { html } from '@lion/core';
|
||||||
import '@lion/core/test-helpers';
|
|
||||||
import { localize } from '@lion/localize';
|
import { localize } from '@lion/localize';
|
||||||
import { localizeTearDown } from '@lion/localize/test-helpers';
|
import { localizeTearDown } from '@lion/localize/test-helpers';
|
||||||
import { expect, fixture as _fixture } from '@open-wc/testing';
|
import { expect, fixture as _fixture } from '@open-wc/testing';
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import './src/closestPolyfill.js';
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import './src/differentKeyEventNamesShimIE.js';
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
"docs",
|
"docs",
|
||||||
"src",
|
"src",
|
||||||
"test",
|
"test",
|
||||||
"test-helpers",
|
|
||||||
"translations",
|
"translations",
|
||||||
"types"
|
"types"
|
||||||
],
|
],
|
||||||
|
|
@ -31,10 +30,7 @@
|
||||||
"prepublishOnly": "npm run publish-docs",
|
"prepublishOnly": "npm run publish-docs",
|
||||||
"test": "cd ../../ && npm run test:browser -- --group core"
|
"test": "cd ../../ && npm run test:browser -- --group core"
|
||||||
},
|
},
|
||||||
"sideEffects": [
|
"sideEffects": false,
|
||||||
"./closestPolyfill.js",
|
|
||||||
"./differentKeyEventNamesShimIE.js"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@open-wc/dedupe-mixin": "^1.3.0",
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
||||||
"@open-wc/scoped-elements": "^2.0.1",
|
"@open-wc/scoped-elements": "^2.0.1",
|
||||||
|
|
@ -49,9 +45,6 @@
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.js",
|
".": "./index.js",
|
||||||
"./test-helpers": "./test-helpers/index.js",
|
|
||||||
"./closestPolyfill": "./src/closestPolyfill.js",
|
|
||||||
"./differentKeyEventNamesShimIE": "./src/differentKeyEventNamesShimIE.js",
|
|
||||||
"./docs/*": "./docs/*"
|
"./docs/*": "./docs/*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* From: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!Element.prototype.matches) {
|
|
||||||
Element.prototype.matches =
|
|
||||||
Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Element.prototype.closest) {
|
|
||||||
Element.prototype.closest = function (s) {
|
|
||||||
var el = this;
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (Element.prototype.matches.call(el, s)) return el;
|
|
||||||
el = el.parentElement || el.parentNode;
|
|
||||||
} while (el !== null && el.nodeType === 1);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
if (typeof window.KeyboardEvent !== 'function') {
|
|
||||||
// e.g. is IE and needs "polyfill"
|
|
||||||
const event = KeyboardEvent.prototype;
|
|
||||||
const descriptor = Object.getOwnPropertyDescriptor(event, 'key');
|
|
||||||
if (descriptor) {
|
|
||||||
/** @type {Object.<string, string>} */
|
|
||||||
const keys = {
|
|
||||||
Win: 'Meta',
|
|
||||||
Scroll: 'ScrollLock',
|
|
||||||
Spacebar: ' ',
|
|
||||||
|
|
||||||
Down: 'ArrowDown',
|
|
||||||
Left: 'ArrowLeft',
|
|
||||||
Right: 'ArrowRight',
|
|
||||||
Up: 'ArrowUp',
|
|
||||||
|
|
||||||
Del: 'Delete',
|
|
||||||
Apps: 'ContextMenu',
|
|
||||||
Esc: 'Escape',
|
|
||||||
|
|
||||||
Multiply: '*',
|
|
||||||
Add: '+',
|
|
||||||
Subtract: '-',
|
|
||||||
Decimal: '.',
|
|
||||||
Divide: '/',
|
|
||||||
};
|
|
||||||
Object.defineProperty(event, 'key', {
|
|
||||||
// eslint-disable-next-line object-shorthand, func-names
|
|
||||||
get: function () {
|
|
||||||
if (descriptor.get) {
|
|
||||||
const key = descriptor.get.call(this);
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-prototype-builtins
|
|
||||||
return keys.hasOwnProperty(key) ? keys[key] : key;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from './keyboardEventShimIE.js';
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
if (typeof window.KeyboardEvent !== 'function') {
|
|
||||||
// e.g. is IE and needs "polyfill"
|
|
||||||
const KeyboardEvent = (event, _params) => {
|
|
||||||
// current spec for it https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent
|
|
||||||
const params = {
|
|
||||||
bubbles: false,
|
|
||||||
cancelable: false,
|
|
||||||
view: document.defaultView,
|
|
||||||
key: false,
|
|
||||||
location: false,
|
|
||||||
ctrlKey: false,
|
|
||||||
shiftKey: false,
|
|
||||||
altKey: false,
|
|
||||||
metaKey: false,
|
|
||||||
repeat: false,
|
|
||||||
..._params,
|
|
||||||
};
|
|
||||||
const modifiersListArray = [];
|
|
||||||
if (params.ctrlKey) {
|
|
||||||
modifiersListArray.push('Control');
|
|
||||||
}
|
|
||||||
if (params.shiftKey) {
|
|
||||||
modifiersListArray.push('Shift');
|
|
||||||
}
|
|
||||||
if (params.altKey) {
|
|
||||||
modifiersListArray.push('Alt');
|
|
||||||
}
|
|
||||||
if (params.metaKey) {
|
|
||||||
modifiersListArray.push('Meta');
|
|
||||||
}
|
|
||||||
|
|
||||||
const ev = document.createEvent('KeyboardEvent');
|
|
||||||
// IE Spec for it https://technet.microsoft.com/en-us/windows/ff975297(v=vs.60)
|
|
||||||
ev.initKeyboardEvent(
|
|
||||||
event,
|
|
||||||
params.bubbles,
|
|
||||||
params.cancelable,
|
|
||||||
params.view,
|
|
||||||
params.key,
|
|
||||||
params.location,
|
|
||||||
modifiersListArray.join(' '),
|
|
||||||
params.repeat ? 1 : 0,
|
|
||||||
params.locale,
|
|
||||||
);
|
|
||||||
return ev;
|
|
||||||
};
|
|
||||||
KeyboardEvent.prototype = window.Event.prototype;
|
|
||||||
window.KeyboardEvent = KeyboardEvent;
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { css, dedupeMixin, html, ScopedElementsMixin, SlotMixin } from '@lion/core';
|
import { css, dedupeMixin, html, ScopedElementsMixin, SlotMixin } from '@lion/core';
|
||||||
import '@lion/core/closestPolyfill';
|
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { ChoiceGroupMixin, FormControlMixin, FormRegistrarMixin } from '@lion/form-core';
|
import { ChoiceGroupMixin, FormControlMixin, FormRegistrarMixin } from '@lion/form-core';
|
||||||
import { LionOptions } from './LionOptions.js';
|
import { LionOptions } from './LionOptions.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { LitElement, repeat } from '@lion/core';
|
import { LitElement, repeat } from '@lion/core';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { Required } from '@lion/form-core';
|
import { Required } from '@lion/form-core';
|
||||||
import { LionOptions } from '@lion/listbox';
|
import { LionOptions } from '@lion/listbox';
|
||||||
import '@lion/listbox/define';
|
import '@lion/listbox/define';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { EventTargetShim } from '@lion/core';
|
import { EventTargetShim } from '@lion/core';
|
||||||
// eslint-disable-next-line import/no-cycle
|
// eslint-disable-next-line import/no-cycle
|
||||||
import { overlays } from './overlays.js';
|
import { overlays } from './overlays.js';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
||||||
import { fixtureSync } from '@open-wc/testing-helpers';
|
import { fixtureSync } from '@open-wc/testing-helpers';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import { LionListbox } from '@lion/listbox';
|
import { LionListbox } from '@lion/listbox';
|
||||||
import { html, ScopedElementsMixin, SlotMixin, browserDetection } from '@lion/core';
|
import { html, ScopedElementsMixin, SlotMixin, browserDetection } from '@lion/core';
|
||||||
import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
|
import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
|
||||||
|
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { LionSelectInvoker } from './LionSelectInvoker.js';
|
import { LionSelectInvoker } from './LionSelectInvoker.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { Required } from '@lion/form-core';
|
||||||
import { expect, triggerBlurFor, triggerFocusFor, fixture } from '@open-wc/testing';
|
import { expect, triggerBlurFor, triggerFocusFor, fixture } from '@open-wc/testing';
|
||||||
import { html } from 'lit/static-html.js';
|
import { html } from 'lit/static-html.js';
|
||||||
import { browserDetection } from '@lion/core';
|
import { browserDetection } from '@lion/core';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import '@lion/listbox/define';
|
import '@lion/listbox/define';
|
||||||
import '@lion/select-rich/define';
|
import '@lion/select-rich/define';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { LitElement } from '@lion/core';
|
import { LitElement } from '@lion/core';
|
||||||
import '@lion/core/differentKeyEventNamesShimIE';
|
|
||||||
import { renderLitAsNode } from '@lion/helpers';
|
import { renderLitAsNode } from '@lion/helpers';
|
||||||
import { LionOption } from '@lion/listbox';
|
import { LionOption } from '@lion/listbox';
|
||||||
import '@lion/listbox/define';
|
import '@lion/listbox/define';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue