fix(layout): don't expose locked sidebar items as draggables (#8064)

While the menu order is locked, the sidebar items were still registered as
disabled sortables, so dnd-kit gave each nav button a draggable role
description, aria-disabled=true, aria-pressed and the drag instructions.
Screen readers announced every item as an unavailable draggable toggle.
Only wrap the items in SortableItem while reordering is unlocked.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mrhard9090
2026-09-27 12:37:54 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 5d7dc3aed9
commit 1638ab48d8
2 changed files with 12 additions and 6 deletions
+1
View File
@@ -4,6 +4,7 @@
<summary><strong> 🐞 修复问题 </strong></summary>
- 修复「代理集合」「规则集合」订阅响应较慢时更新误报失败、且不显示真实失败原因的问题
- 修复读屏软件将普通模式下的侧边栏导航项播报为不可用的可拖拽控件的问题
**🖥️ Windows**
+11 -6
View File
@@ -100,13 +100,18 @@ export const LayoutSidebar = (props: LayoutSidebarProps) => {
const item = navItemMap.get(path)
if (!item) return null
// A registered sortable, even a disabled one, gets the drag-and-drop ARIA
// attributes, so screen readers announce every item as a disabled draggable.
if (!menuUnlocked) {
return (
<LayoutItem key={item.path} to={item.path} icon={item.icon}>
{t(item.label)}
</LayoutItem>
)
}
return (
<SortableItem
key={item.path}
id={item.path}
index={index}
disabled={!menuUnlocked}
>
<SortableItem key={item.path} id={item.path} index={index}>
{(sortable) => (
<LayoutItem to={item.path} icon={item.icon} sortable={sortable}>
{t(item.label)}