Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/src/styles/STYLE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ CSS 自定义属性同样按变量名排序。嵌套选择器、伪类和媒体

组件内需要展示滚动条时优先使用 Element Plus 的 `el-scrollbar`,保持滚动条样式和交互一致。

页面有独立的内部滚动区时,可在 `MkViewLayout` 正文的根元素上添加 `mk-scrollbar-fill-height`。
该元素须是 `el-scrollbar` 内容层的直接子元素,由 `app.scss` 将内容层高度约束为可用高度。

`el-textarea` 保留原生文本域滚动,由 `element-plus.scss` 统一对齐 `el-scrollbar` 的外观:
Chromium/Safari 使用 6px 滚动条、4px 圆角滑块和透明轨道,滑块复用 Element Plus 滚动条
颜色与透明度变量,默认 30%、悬停 50%。Firefox 使用 `scrollbar-width: thin` 和
Expand Down
5 changes: 5 additions & 0 deletions ui/src/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ h6 {
}

/* scrollbar */
// 让内部有独立滚动区的页面使用外层滚动容器的可用高度。
.el-scrollbar__view:has(> .mk-scrollbar-fill-height) {
height: 100%;
}

// 让一些组件内部滚动条 不会限制在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%.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/application-detail/chat-user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ onMounted(() => loadChatUserGroups())
</script>

<template>
<div v-loading="loading" :inert="loading" class="-mx-6 -mb-6 flex min-h-0 flex-1">
<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.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/knowledge-detail/chat-user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ onMounted(() => loadChatUserGroups())
</script>

<template>
<div v-loading="loading" :inert="loading" class="-mx-6 -mb-6 flex min-h-0 flex-1">
<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>
Expand Down
9 changes: 1 addition & 8 deletions ui/src/views/knowledge-detail/hit-test/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function testKnowledge(query: Required<Pick<KnowledgeHitTestPayload, 'query_text
</script>

<template>
<div class="mk-knowledge-hit-test -ml-6 -mr-6 -mb-6 grid min-h-0 flex-1 grid-cols-2 overflow-hidden">
<div class="mk-scrollbar-fill-height -ml-6 -mr-6 -mb-6 grid min-h-0 flex-1 grid-cols-2 overflow-hidden">
<!-- 左侧 -->
<el-scrollbar class="min-h-0 min-w-0" view-class="px-6 pb-6">
<header class="flex-align-center gap-2 py-4">
Expand Down Expand Up @@ -256,10 +256,3 @@ function testKnowledge(query: Required<Pick<KnowledgeHitTestPayload, 'query_text
@closed="selectedParagraph = undefined"
/>
</template>

<style scoped lang="scss">
// 仅约束召回测试的外层内容高度,由左右两栏各自负责滚动。
: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.

Loading