Skip to content

fix: constrain nested scrolling in authorization and retrieval views - #8300

Merged
wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_layout
Dec 4, 2026
Merged

wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_layout

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: constrain nested scrolling in authorization and retrieval views

:global(.el-scrollbar__view:has(> .mk-knowledge-hit-test)) {
height: 100%;
}
</style>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No syntax errors in this diff. The main risks are CSS/contract-related:

  1. Root component class removed

    • Replacing mk-knowledge-hit-test with mk-scrollbar-fill-height removes the component-specific selector hook.
    • If mk-knowledge-hit-test is referenced elsewhere (tests, global CSS, analytics, debugging, E2E selectors), this will break.
    • Safer approach unless removal is intentional:
      <div class="mk-knowledge-hit-test mk-scrollbar-fill-height -ml-6 ...">
  2. Verify mk-scrollbar-fill-height exists and is equivalent

    • The removed CSS did this:
      :global(.el-scrollbar__view:has(> .mk-knowledge-hit-test)) {
        height: 100%;
      }
    • The new class must reproduce the same layout behavior, e.g. effectively:
      .el-scrollbar__view:has(> .mk-scrollbar-fill-height) {
        height: 100%;
      }
    • If mk-scrollbar-fill-height is not defined or only sets height: 100% on the element itself rather than the parent .el-scrollbar__view, the outer scroll view may collapse and inner scrolling may stop working.
  3. Class name is a global layout contract

    • mk-scrollbar-fill-height appears to be a utility/marker class used to target a parent via :has(...).
    • If so, it should be documented and used consistently. The name is slightly misleading because it may not set height on the element itself but on its scrollbar parent.
    • Consider a clearer marker name such as mk-fill-scrollbar-view or keeping the component-specific class for clarity.
  4. :has() compatibility still matters

    • Removing the scoped :global(...:has(...)) is good if the utility centralizes it, but if the utility also uses :has(), browser support/performance concerns remain the same.
    • If support is a concern, prefer an explicit wrapper with height: 100% or use el-scrollbar layout props rather than relying on :has().
  5. Test in all parent contexts

    • This layout depends on the parent height chain. Test in dialogs, tabs, drawers, and empty/loading states to ensure both left and right el-scrollbar areas scroll correctly after the change.

Overall: the change can be a good cleanup if mk-scrollbar-fill-height is a known global utility with equivalent CSS. To minimize risk, keep mk-knowledge-hit-test alongside the new utility class unless you have verified it is unused.

@wangdan-fit2cloud
wangdan-fit2cloud merged commit b47939c into v3 Dec 4, 2026
3 of 4 checks passed
@wangdan-fit2cloud
wangdan-fit2cloud deleted the pr@v3@fix_layout branch December 4, 2026 08:23
Comment thread ui/src/styles/app.scss

// 让一些组件内部滚动条 不会限制在padding内,滚动条贴在最右侧
.mk-scrollbar-right {
&.el-scrollbar {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is SCSS/Less (because // comments are used), the added rule is syntactically valid. Main review points:

  1. // comments are not valid in plain CSS

    • If this file is ever processed as pure CSS, // is invalid. Since surrounding code already uses //, this is probably fine, but confirm the file is compiled by SCSS/Less.
  2. :has() browser compatibility

    • :has() is modern but not supported by older browsers/WebViews. If the project supports older embedded browsers or legacy Safari/Chrome, provide a fallback or add a modifier class directly to .el-scrollbar__view instead.
  3. Global selector may cause side effects

    • .el-scrollbar__view:has(> .mk-scrollbar-fill-height) applies to all Element Plus scrollbars globally. Consider scoping it to a page/container:
    .some-page .el-scrollbar__view:has(> .mk-scrollbar-fill-height) {
      height: 100%;
    }
  4. Direct-child restriction

    • The rule only matches when .mk-scrollbar-fill-height is a direct child of .el-scrollbar__view. If it can be nested deeper, the rule will not apply.
  5. height: 100% may not work or may clip

    • height: 100% requires the parent chain to have a definite height. If the goal is “fill at least the available height while allowing content to grow,” consider:
    min-height: 100%;

    instead of height: 100%.

  6. Box model consideration

    • If .el-scrollbar__view has padding or borders, height: 100% can overflow. Add:
    box-sizing: border-box;
  7. Prefer a direct modifier class if possible

    • Relying on :has() can be avoided by adding a class such as mk-scrollbar-fill-height directly to .el-scrollbar__view via the component API or JS.

Suggested safer/scoped version:

.some-page {
  .el-scrollbar__view:has(> .mk-scrollbar-fill-height) {
    min-height: 100%;
    box-sizing: border-box;
  }
}

No syntax irregularity in the diff itself, but the main risks are browser support, global side effects, and layout assumptions around height: 100%.

<div v-loading="loading" :inert="loading" class="mk-scrollbar-fill-height -mx-6 -mb-6 flex min-h-0 flex-1">
<aside class="flex-column w-sidebar-expanded shrink-0 border-r">
<div class="shrink-0 p-4">
<h4>{{ t('authorization.byGroup') }}</h4>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Only one line changed: an extra mk-scrollbar-fill-height class was added to the root container.

<div v-loading="loading" :inert="loading" class="mk-scrollbar-fill-height -mx-6 -mb-6 flex min-h-0 flex-1">

Potential issues / risks

  1. Custom class is unverifiable here

    • mk-scrollbar-fill-height is not a Tailwind utility, so I cannot confirm what it does. Its definition should be checked, especially whether it sets height, max-height, or overflow.
    • If it sets height: 100%, it can conflict with flex-1 / min-h-0 and may break the intended flex sizing or create overflow.
  2. Negative margins + fill-height may cause overflow

    • The container has -mx-6 -mb-6. If the new class sets a height based on the parent, the negative bottom margin can make the element taller than its parent and introduce an unwanted outer scrollbar.
  3. Possibly applied at the wrong level

    • The class name suggests scrollbar height filling. Usually that belongs on the actual scroll container (the aside or a nested content area), not on the flex wrapper. Applying it to the wrapper may not affect the element that actually scrolls.
  4. inert also affects the loading overlay

    • :inert="loading" applies to the entire subtree. Since v-loading renders its overlay/spinner inside this element, the loading indicator is also made inert and removed from the accessibility tree. Screen-reader users may not be informed that loading is in progress.
    • Prefer aria-busy="true" on the container, and/or place inert on a content wrapper rather than the element hosting the loading overlay.
  5. Class ordering

    • Not a bug, but if the project enforces Tailwind class sorting, mk-scrollbar-fill-height may be flagged by the linter/formatter. Follow the project’s convention.

Suggestions

  • Verify mk-scrollbar-fill-height exists in a globally loaded stylesheet and is not dropped by PurgeCSS/content scanning.
  • Confirm it does not override flex: 1 1 0% or min-height: 0.
  • Test with a short viewport, a long chat list, and the loading state active.
  • Consider applying the class to the actual scrollable child instead of this wrapper.
  • Reconsider :inert="loading" to preserve accessibility of the loading indicator; use aria-busy in addition.

Overall, the change is small and likely safe, but its correctness depends entirely on the definition of mk-scrollbar-fill-height, which is not included in the diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants