为什么另一个客户元素的阴影根中的阴影元素的 % 宽度和高度不起作用?

Why does the % width and height for a shadow element in the shadow root of another customer element not work?

HTML:

<options-container>
  <options-panel panel-type=“login”></options-panel>
</options-container>

父自定义元素样式:

options-container {
  display: inline-flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  height: calc(100vh - 52px);
  height: calc(100vh - (45px + 0.3vw));
  min-height: max(calc(56.25vw - 52px), calc(100vh - 52px));
  min-height: max(calc(56.25vw - (45px + 0.3vw)), calc(100vh - (45px + 0.3vw)));
  position: fixed;
  top: 52px;
  top: calc(45px + 0.3vw);
  right: 0;
  z-index: 1;
  width: calc(300px + 3vw);
  -webkit-backface-visibility: hidden;
  -webkit-perspective: 1000;
  -webkit-transform-style: preserve-3d;
  -webkit-transition: width 0.5s ease-in-out;
  -moz-transition: width 0.5s ease-in-out;
  -o-transition: width 0.5s ease-in-out;
  transition: width 0.5s ease-in-out;
  will-change: width;
  pointer-events: none;
}

子元素(在上述元素的阴影根中)样式:

:host {
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  width: 90%;
  height: auto;
  max-height: 100vh;
  padding: 10px;
  min-height: 10vw;
  background-color: var(--white, white);
  border: 2px solid var(--light-gray, lightgray);
  border: 0.2vw solid var(--light-gray, lightgray);
  box-sizing: border-box;
  margin-top: 20px;
  border-radius: 10px;
  border-radius: calc(8px + 0.3vw);
  overflow: hidden;
  box-shadow: 0px 0px 10px 0px var(--shadow, black);
  box-shadow: 0px 0px calc(8px + 0.3vw) 0px var(--shadow, black);
  pointer-events: auto;
  animation: fly-down 1.5s ease-out;
  animation-play-state: running;
  -webkit-transform: translate3d(0, 0, 0) !important;
  -webkit-backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  -webkit-transition: max-height 0.5s ease-in-out 0.5s;
  -moz-transition: max-height 0.5s ease-in-out 0.5s;
  -o-transition: max-height 0.5s ease-in-out 0.5s;
  transition: max-height 0.5s ease-in-out 0.5s;
  will-change: max-height;
}

父元素框模型

子元素框模型

在试图解释这种行为时遇到了真正的麻烦,而在试图让子元素变得可见时遇到了更多麻烦。我可能会遗漏一些非常小的东西,我不知道。但任何指导 and/or 解释将不胜感激!

已找到答案!

令人尴尬的菜鸟错误,我将影子根附加到 <options-container> 元素,这就是子元素未被渲染的原因。与 CSS 完全无关。

给自己和处于类似情况的其他人的注意事项:检查影子根。

正在做

this.shadowroot = this.attachShadow({模式: 'open'});

就是答案。