Skip to content
Snippets Groups Projects
Commit ae6193fd authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Remove "slot-hidden" class of elements in html of injected slots after page was loaded

parent 2ca1fe37
No related branches found
No related tags found
No related merge requests found
Pipeline #45493 passed
{ {
"name": "@dbp-toolkit/app-shell", "name": "@dbp-toolkit/app-shell",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/app-shell", "homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/app-shell",
"version": "0.2.2", "version": "0.2.3",
"main": "src/index.js", "main": "src/index.js",
"license": "LGPL-2.1-or-later", "license": "LGPL-2.1-or-later",
"repository": { "repository": {
......
...@@ -3,6 +3,7 @@ import {html, css} from 'lit-element'; ...@@ -3,6 +3,7 @@ import {html, css} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {LanguageSelect} from '@dbp-toolkit/language-select'; import {LanguageSelect} from '@dbp-toolkit/language-select';
import {Icon} from '@dbp-toolkit/common'; import {Icon} from '@dbp-toolkit/common';
import {querySlotted} from '@dbp-toolkit/common/utils';
import {AuthKeycloak} from '@dbp-toolkit/auth'; import {AuthKeycloak} from '@dbp-toolkit/auth';
import {AuthMenuButton} from './auth-menu-button.js'; import {AuthMenuButton} from './auth-menu-button.js';
import {Notification} from '@dbp-toolkit/notification'; import {Notification} from '@dbp-toolkit/notification';
...@@ -839,14 +840,17 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -839,14 +840,17 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
const mainClassMap = classMap({hidden: appHidden}); const mainClassMap = classMap({hidden: appHidden});
const slotClassMap = classMap({hidden: !appHidden}); const slotClassMap = classMap({hidden: !appHidden});
// XXX: Safari 11 doesn't like CSS being applied to slots or via HTML,
// so we have to remove the slot instead of hiding it
if (!appHidden) { if (!appHidden) {
this.updateComplete.then(() => { this.updateComplete.then(() => {
// XXX: Safari 11 doesn't like CSS being applied to slots or via HTML,
// so we have to remove the slot instead of hiding it
// select slots with no name attribute // select slots with no name attribute
const slot = this.shadowRoot.querySelector("slot:not([name])"); const slot = this.shadowRoot.querySelector("slot:not([name])");
if (slot) if (slot)
slot.remove(); slot.remove();
// remove the "slot-hidden" class of elements in the html of injected slots to show them after the page was loaded
querySlotted(this.shadowRoot, '.slot-hidden').forEach((slot) => { slot.classList.remove("slot-hidden"); });
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment