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",
"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",
"license": "LGPL-2.1-or-later",
"repository": {
......
......@@ -3,6 +3,7 @@ import {html, css} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {LanguageSelect} from '@dbp-toolkit/language-select';
import {Icon} from '@dbp-toolkit/common';
import {querySlotted} from '@dbp-toolkit/common/utils';
import {AuthKeycloak} from '@dbp-toolkit/auth';
import {AuthMenuButton} from './auth-menu-button.js';
import {Notification} from '@dbp-toolkit/notification';
......@@ -839,14 +840,17 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
const mainClassMap = 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) {
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
const slot = this.shadowRoot.querySelector("slot:not([name])");
if (slot)
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.
Please register or to comment