From 00a16bee76bf2166a510691b6add6b1545a95433 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 5 Feb 2023 23:32:54 +0100 Subject: [PATCH] web/elements: add dropdown css to DOM directly instead of including Signed-off-by: Jens Langhammer --- authentik/core/templates/base/skeleton.html | 1 - web/rollup.config.js | 4 ---- web/src/elements/forms/SearchSelect.ts | 4 ++++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/authentik/core/templates/base/skeleton.html b/authentik/core/templates/base/skeleton.html index f763941a1..97235f986 100644 --- a/authentik/core/templates/base/skeleton.html +++ b/authentik/core/templates/base/skeleton.html @@ -13,7 +13,6 @@ - {% block head_before %} {% endblock %} diff --git a/web/rollup.config.js b/web/rollup.config.js index ad4982bbb..18ae58cb0 100644 --- a/web/rollup.config.js +++ b/web/rollup.config.js @@ -24,10 +24,6 @@ export const resources = [ src: "node_modules/@patternfly/patternfly/patternfly-base.css", dest: "dist/", }, - { - src: "node_modules/@patternfly/patternfly/components/Dropdown/dropdown.css", - dest: "dist/", - }, { src: "node_modules/@patternfly/patternfly/components/Page/page.css", dest: "dist/", diff --git a/web/src/elements/forms/SearchSelect.ts b/web/src/elements/forms/SearchSelect.ts index 47cb0a87c..d376e6e9f 100644 --- a/web/src/elements/forms/SearchSelect.ts +++ b/web/src/elements/forms/SearchSelect.ts @@ -9,6 +9,7 @@ import { CSSResult, TemplateResult, html, render } from "lit"; import { customElement, property } from "lit/decorators.js"; import AKGlobal from "@goauthentik/common/styles/authentik.css"; +import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; import PFSelect from "@patternfly/patternfly/components/Select/select.css"; @@ -73,6 +74,9 @@ export class SearchSelect extends AKElement { constructor() { super(); + if (!document.adoptedStyleSheets.includes(PFDropdown)) { + document.adoptedStyleSheets = [...document.adoptedStyleSheets, PFDropdown]; + } this.dropdownContainer = document.createElement("div"); this.observer = new IntersectionObserver(() => { this.open = false;