Repository navigation
fix: constrain nested scrolling in authorization and retrieval views - #8300
Conversation
| :global(.el-scrollbar__view:has(> .mk-knowledge-hit-test)) { | ||
| height: 100%; | ||
| } | ||
| </style> |
There was a problem hiding this comment.
No syntax errors in this diff. The main risks are CSS/contract-related:
-
Root component class removed
- Replacing
mk-knowledge-hit-testwithmk-scrollbar-fill-heightremoves the component-specific selector hook. - If
mk-knowledge-hit-testis 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 ...">
- Replacing
-
Verify
mk-scrollbar-fill-heightexists 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-heightis not defined or only setsheight: 100%on the element itself rather than the parent.el-scrollbar__view, the outer scroll view may collapse and inner scrolling may stop working.
- The removed CSS did this:
-
Class name is a global layout contract
mk-scrollbar-fill-heightappears 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-viewor keeping the component-specific class for clarity.
-
: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 useel-scrollbarlayout props rather than relying on:has().
- Removing the scoped
-
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-scrollbarareas scroll correctly after the change.
- This layout depends on the parent height chain. Test in dialogs, tabs, drawers, and empty/loading states to ensure both left and right
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.
|
|
||
| // 让一些组件内部滚动条 不会限制在padding内,滚动条贴在最右侧 | ||
| .mk-scrollbar-right { | ||
| &.el-scrollbar { |
There was a problem hiding this comment.
Assuming this is SCSS/Less (because // comments are used), the added rule is syntactically valid. Main review points:
-
//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.
- If this file is ever processed as pure CSS,
-
: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__viewinstead.
-
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%; }
-
Direct-child restriction
- The rule only matches when
.mk-scrollbar-fill-heightis a direct child of.el-scrollbar__view. If it can be nested deeper, the rule will not apply.
- The rule only matches when
-
height: 100%may not work or may clipheight: 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%. -
Box model consideration
- If
.el-scrollbar__viewhas padding or borders,height: 100%can overflow. Add:
box-sizing: border-box;
- If
-
Prefer a direct modifier class if possible
- Relying on
:has()can be avoided by adding a class such asmk-scrollbar-fill-heightdirectly to.el-scrollbar__viewvia the component API or JS.
- Relying on
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> |
There was a problem hiding this comment.
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
-
Custom class is unverifiable here
mk-scrollbar-fill-heightis not a Tailwind utility, so I cannot confirm what it does. Its definition should be checked, especially whether it setsheight,max-height, oroverflow.- If it sets
height: 100%, it can conflict withflex-1/min-h-0and may break the intended flex sizing or create overflow.
-
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.
- The container has
-
Possibly applied at the wrong level
- The class name suggests scrollbar height filling. Usually that belongs on the actual scroll container (the
asideor a nested content area), not on the flex wrapper. Applying it to the wrapper may not affect the element that actually scrolls.
- The class name suggests scrollbar height filling. Usually that belongs on the actual scroll container (the
-
inertalso affects the loading overlay:inert="loading"applies to the entire subtree. Sincev-loadingrenders 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 placeinerton a content wrapper rather than the element hosting the loading overlay.
-
Class ordering
- Not a bug, but if the project enforces Tailwind class sorting,
mk-scrollbar-fill-heightmay be flagged by the linter/formatter. Follow the project’s convention.
- Not a bug, but if the project enforces Tailwind class sorting,
Suggestions
- Verify
mk-scrollbar-fill-heightexists in a globally loaded stylesheet and is not dropped by PurgeCSS/content scanning. - Confirm it does not override
flex: 1 1 0%ormin-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; usearia-busyin 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.
fix: constrain nested scrolling in authorization and retrieval views