Skip to content

Commit

Permalink
feat(uui-popover-container): remove the Firefox popover polyfill (#858)
Browse files Browse the repository at this point in the history
* feat: remove the Firefox polyfill as Firefox now natively supports the Popover API

* test: add test for `popover` attribute

* package json

* revert package lock

* update package lock

* update github action to install all playwright dependencies

---------

Co-authored-by: JesmoDev <26099018+JesmoDev@users.noreply.github.com>
  • Loading branch information
iOvergaard and JesmoDev committed Jul 25, 2024
1 parent 286a605 commit a8d87b5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 179 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
cache: 'npm'
- run: npm install
- run: npm run lint
- run: sudo npx playwright install-deps
- name: Install Playwright dependencies
run: npx playwright install --with-deps
- run: npm run test

build:
Expand Down
38 changes: 28 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
"vite-tsconfig-paths": "4.3.2",
"web-component-analyzer": "2.0.0"
},
"overrides": {
"playwright": "^1.45.3"
},
"workspaces": [
"./packages/*"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { findAncestorByAttributeValue } from '@umbraco-ui/uui-base/lib/utils';
import { css, html, LitElement } from 'lit';
import { property, state } from 'lit/decorators.js';
import { polyfill } from './uui-popover-polyfill.js';

export type PopoverContainerPlacement =
| 'top'
Expand Down Expand Up @@ -72,10 +71,6 @@ export class UUIPopoverContainerElement extends LitElement {
#scrollParents: Element[] = [];

connectedCallback(): void {
//TODO: Remove this polyfill when firefox supports the new popover API
!Object.prototype.hasOwnProperty.call(HTMLElement, 'popover') &&
polyfill.bind(this)();

if (!this.hasAttribute('popover')) {
this.setAttribute('popover', '');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ describe('UUIPopoverContainerElement', () => {

beforeEach(async () => {
element = await fixture(html`
<uui-popover-container></uui-popover-container>
<uui-popover-container id="my-popover">
Hello world
</uui-popover-container>
`);
});

Expand All @@ -17,4 +19,9 @@ describe('UUIPopoverContainerElement', () => {
it('passes the a11y audit', async () => {
await expect(element).shadowDom.to.be.accessible();
});

it('gets the popover attribute', async () => {
await element.updateComplete;
expect(element).to.have.attribute('popover');
});
});
162 changes: 0 additions & 162 deletions packages/uui-popover-container/lib/uui-popover-polyfill.ts

This file was deleted.

0 comments on commit a8d87b5

Please sign in to comment.