mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Wait for stylesheets to load before displaying shadow DOM elements (#1773)
Wait for stylesheets to load before displaying shadow DOM elements
This commit is contained in:
parent
f62c1d6a1f
commit
3dfb53a0a3
6 changed files with 14 additions and 2 deletions
|
|
@ -86,6 +86,8 @@ class Autocomplete {
|
|||
const styleSheet = createStylesheet('css/autocomplete.css');
|
||||
const colorStyleSheet = createStylesheet('css/colors.css');
|
||||
this.wrapper = kpxcUI.createElement('div');
|
||||
this.wrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => this.wrapper.style.display = 'block');
|
||||
this.container = kpxcUI.createElement('div', 'kpxcAutocomplete-container', { 'id': 'kpxcAutocomplete-container' });
|
||||
|
||||
this.shadowRoot = this.wrapper.attachShadow({ mode: 'closed' });
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ kpxcBanner.create = async function(credentials = {}) {
|
|||
const colorStyleSheet = createStylesheet('css/colors.css');
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
|
||||
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
|
||||
this.shadowRoot.append(colorStyleSheet);
|
||||
this.shadowRoot.append(styleSheet);
|
||||
|
|
|
|||
|
|
@ -128,15 +128,17 @@ kpxcCustomLoginFieldsBanner.create = async function() {
|
|||
|
||||
initColorTheme(banner);
|
||||
|
||||
const bannerStyleSheet = createStylesheet('css/banner.css');
|
||||
const styleSheet = createStylesheet('css/banner.css');
|
||||
const defineStyleSheet = createStylesheet('css/define.css');
|
||||
const buttonStyleSheet = createStylesheet('css/button.css');
|
||||
const colorStyleSheet = createStylesheet('css/colors.css');
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
|
||||
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
|
||||
this.shadowRoot.append(colorStyleSheet);
|
||||
this.shadowRoot.append(bannerStyleSheet);
|
||||
this.shadowRoot.append(styleSheet);
|
||||
this.shadowRoot.append(defineStyleSheet);
|
||||
this.shadowRoot.append(buttonStyleSheet);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,8 @@ TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) {
|
|||
|
||||
const styleSheet = createStylesheet('css/totp.css');
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
|
||||
|
||||
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
|
||||
this.shadowRoot.append(styleSheet);
|
||||
|
|
|
|||
|
|
@ -252,6 +252,8 @@ kpxcUI.createNotification = function(type, message) {
|
|||
|
||||
const styleSheet = createStylesheet('css/notification.css');
|
||||
notificationWrapper = notificationWrapper || document.createElement('div');
|
||||
notificationWrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => notificationWrapper.style.display = 'block');
|
||||
this.shadowRoot = notificationWrapper.attachShadow({ mode: 'closed' });
|
||||
if (!this.shadowRoot) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ UsernameFieldIcon.prototype.createIcon = function(field) {
|
|||
|
||||
const styleSheet = createStylesheet('css/username.css');
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.style.display = 'none';
|
||||
styleSheet.addEventListener('load', () => wrapper.style.display = 'block');
|
||||
|
||||
this.shadowRoot = wrapper.attachShadow({ mode: 'closed' });
|
||||
this.shadowRoot.append(styleSheet);
|
||||
|
|
|
|||
Loading…
Reference in a new issue