Repository navigation
fix: prevent disabled menu items from highlighting - #763
Merged
Merged
Conversation
1. Add enabled check to highlighted property so disabled menu items never enter highlighted state 2. Update textColor binding to only use highlighted text color when the control is both enabled and highlighted 3. Gate the highlight panel Loader activation on enabled state to avoid rendering hover visuals for disabled items Influence: 1. Open a menu containing both enabled and disabled items and verify disabled items do not highlight on hover 2. Verify enabled items still highlight correctly on hover and when their submenu is visible 3. Check that disabled item text remains in the normal (non-highlighted) color when hovered 4. Confirm no highlight panel renders behind disabled items during hover 5. Test submenu open/close behavior on enabled items is unaffected 6. Verify opacity for disabled items stays consistent at 0.4 fix: 禁止禁用状态的菜单项显示高亮 1. 在 highlighted 属性中加入 enabled 判断,确保禁用的菜单项不会进入高亮 状态 2. 更新 textColor 绑定,仅在控件同时处于启用和高亮状态时使用高亮文字颜色 3. 高亮面板 Loader 的激活条件加入 enabled 判断,避免为禁用项渲染悬停视觉 效果 Influence: 1. 打开包含启用和禁用项的菜单,验证禁用项悬停时不高亮 2. 验证启用项在悬停及子菜单可见时仍能正确高亮 3. 检查禁用项文字在悬停时保持普通(非高亮)颜色 4. 确认禁用项悬停时不会渲染高亮面板 5. 测试启用项的子菜单打开/关闭行为不受影响 6. 验证禁用项透明度保持为 0.4 Log: Fixed disabled menu items incorrectly showing highlight on hover PMS: BUG-380835
Reviewer's GuideUIPrevent disabled menu items from entering the highlighted state, using highlighted text color, or rendering the highlight panel.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="qt6/src/qml/MenuItem.qml" line_range="20" />
<code_context>
spacing: DS.Style.control.spacing
opacity: D.ColorSelector.controlState === D.DTK.DisabledState ? 0.4 : 1
- highlighted: hovered || (subMenu && subMenu.visible)
+ highlighted: enabled && (hovered || (subMenu && subMenu.visible))
icon {
height: DS.Style.menu.item.iconSize.height
</code_context>
<issue_to_address>
**Disabled combo items remain highlighted**
When a disabled ComboBox entry is the current `highlightedIndex`, `ComboBox.delegate` replaces this binding with `highlightedIndex === index` (or `false`), so a disabled item that is the current highlighted index still reports `highlighted: true`. The added text-color and panel guards hide those visuals but do not prevent the highlighted state from reaching callers.
Include the delegate's enabled state in the ComboBox `highlighted` binding, or otherwise ensure the enabled check also applies to that override.
</issue_to_address>
### Comment 2
<location path="qt6/src/qml/MenuItem.qml" line_range="20" />
<code_context>
spacing: DS.Style.control.spacing
opacity: D.ColorSelector.controlState === D.DTK.DisabledState ? 0.4 : 1
- highlighted: hovered || (subMenu && subMenu.visible)
+ highlighted: enabled && (hovered || (subMenu && subMenu.visible))
icon {
height: DS.Style.menu.item.iconSize.height
</code_context>
<issue_to_address>
**Disabled items still highlight on Qt 5**
When the project is built against Qt 5 and a disabled menu item is hovered, a Qt 5 build uses the unchanged `src/qml/MenuItem.qml`, where `highlighted` is not gated by `enabled` and the highlight Loader activates for `control.highlighted`. Hovering a disabled item therefore still shows highlight visuals and highlighted text.
Apply the enabled checks to the Qt 5 `src/qml/MenuItem.qml` implementation as well.
</issue_to_address>
BLumia
approved these changes
Dec 3, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
never enter highlighted state
control is both enabled and highlighted
rendering hover visuals for disabled items
Influence:
disabled items do not highlight on hover
their submenu is visible
color when hovered
fix: 禁止禁用状态的菜单项显示高亮
状态
效果
Influence:
Log: Fixed disabled menu items incorrectly showing highlight on hover
PMS: BUG-380835
Summary by Sourcery
Bug Fixes: