Skip to content

Commit

Permalink
popover: adapt the styling such that FF and Safari play nicely with t…
Browse files Browse the repository at this point in the history
…he anchor positioning. More to understand about that.
  • Loading branch information
Dierk Koenig committed Dec 15, 2024
1 parent 0b6b7d4 commit 080319c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
26 changes: 17 additions & 9 deletions docs/css/kolibri-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ a.skip-link:not(:focus):not(:active) {

/* --- end of utility classes --- */


/* --- experimental popover and anchor positioning --- */

[popover] { /* style that pops for all elements with popover attribute */
flex-direction: column;
gap: .5em;
Expand All @@ -257,24 +260,29 @@ a.skip-link:not(:focus):not(:active) {
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
}
:popover-open::backdrop {
background-color: color-mix(in hsl, white, transparent 70%);
transition: background-color 1s linear;
@starting-style {
background-color: transparent;
}
}

/*For the moment, don't do this as it makes the UI appear flickering when*/
/*the popover closes. Sadly, there seems to be no way to transition back on close. Reserve for later.*/
/*:popover-open::backdrop {*/
/* background-color: color-mix(in hsl, white, transparent 70%);*/
/* transition: background-color 1s linear;*/
/* @starting-style {*/
/* background-color: transparent;*/
/* }*/
/*}*/

.popover_anchor {
/* anchor-name will be set on the element */
position: relative;
display: inline-flex; /* for FF and Safari or it does not always work */
}
.popover_tooltip {
/* position-anchor will be set on the element */
position: absolute; /* override the popover-hidden default */
position: absolute; /* override the popover-hidden default */
inset: unset;
top: anchor(bottom);
top: anchor(top); /* dirty trick for FF and Safari (anchor(bottom) does not work) */
left: anchor(left);
translate: 0 1.2lh; /* dirty trick for FF and Safari */

transform-origin: top center; /* makes expandY a drop-down */
}
Expand Down
8 changes: 4 additions & 4 deletions docs/src/examples/workday/simpleDayProjector.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const projectDay = dayController => {
/** @type {HTMLDivElement} */ const amDiv = elements[0];
/** @type {HTMLDivElement} */ const pmDiv = elements[1];

amDiv.querySelector("#am_start").append(amStartViewLabel, amStartViewSpan);
amDiv.querySelector("#am_end") .append(amEndViewLabel, amEndViewSpan);
pmDiv.querySelector("#pm_start").append(pmStartViewLabel, pmStartViewSpan);
pmDiv.querySelector("#pm_end") .append(pmEndViewLabel, pmEndViewSpan);
amDiv.querySelector("#am_start").replaceWith(amStartViewLabel, amStartViewSpan);
amDiv.querySelector("#am_end") .replaceWith(amEndViewLabel, amEndViewSpan);
pmDiv.querySelector("#pm_start").replaceWith(pmStartViewLabel, pmStartViewSpan);
pmDiv.querySelector("#pm_end") .replaceWith(pmEndViewLabel, pmEndViewSpan);

// no special view and data binding since that is all done by the simpleInputProjector

Expand Down

0 comments on commit 080319c

Please sign in to comment.