aboutsummaryrefslogtreecommitdiff
path: root/static/components
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-10 00:12:52 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-10 00:12:52 +0100
commit03331033ea7105f4f7adbae639c22efa98fa8017 (patch)
tree94c84c64fceb05f7cbf2c414a57af05d7bf2bc29 /static/components
parentPropagate recurring events to frontend. (diff)
downloadcalp-03331033ea7105f4f7adbae639c22efa98fa8017.tar.gz
calp-03331033ea7105f4f7adbae639c22efa98fa8017.tar.xz
Better handling of popup visibility.
Diffstat (limited to 'static/components')
-rw-r--r--static/components/popup-element.ts22
1 files changed, 15 insertions, 7 deletions
diff --git a/static/components/popup-element.ts b/static/components/popup-element.ts
index 0a142348..42e8ee7f 100644
--- a/static/components/popup-element.ts
+++ b/static/components/popup-element.ts
@@ -12,8 +12,6 @@ import { remove_event } from '../server_connect'
/* <popup-element /> */
class PopupElement extends ComponentVEvent {
- isVisible: boolean = false;
-
constructor(uid?: string) {
super(uid);
@@ -74,17 +72,27 @@ class PopupElement extends ComponentVEvent {
return ['visible'];
}
+ attributeChangedCallback(name: string, oldValue?: string, newValue?: string) {
+ switch (name) {
+ case 'visible':
+ this.onVisibilityChange()
+ break;
+ }
+ }
+
get visible(): boolean {
- return this.isVisible;
+ return this.hasAttribute('visible');
}
set visible(isVisible: boolean) {
- this.isVisible = isVisible;
- if (this.isVisible) {
- this.classList.add('visible');
+ if (isVisible) {
+ this.setAttribute('visible', 'visible');
} else {
- this.classList.remove('visible');
+ this.removeAttribute('visible');
}
+ }
+
+ private onVisibilityChange() {
/* TODO better way to find root */
let root;