From ea4ed4cbb768d68877be535fd47d371c10abb3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 8 Oct 2026 11:51:39 -0400 Subject: [PATCH] =?UTF-8?q?SettingsRow=20=C2=B7=20a=20group=20named=20by?= =?UTF-8?q?=20its=20title,=20described=20by=20its=20line,=20so=20assistive?= =?UTF-8?q?=20tech=20says=20what=20each=20control=20sets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/settings/section.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/settings/section.rs b/src/settings/section.rs index b356a65..642180a 100644 --- a/src/settings/section.rs +++ b/src/settings/section.rs @@ -1,8 +1,9 @@ use std::rc::Rc; use gpui::{ - AnyElement, App, ElementId, FontWeight, IntoElement, ParentElement, RenderOnce, SharedString, - Styled, Window, div, + AnyElement, App, ElementId, FontWeight, InteractiveElement as _, IntoElement, ParentElement, + RenderOnce, Role, SharedString, StatefulInteractiveElement as _, Styled, Window, div, + prelude::FluentBuilder as _, }; use crate::{ @@ -179,7 +180,15 @@ impl SettingsRow { impl RenderOnce for SettingsRow { fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement { let theme = cx.theme(); + // The row names its control for assistive tech. + let id = SharedString::from(format!("settings-row-{}", self.title)); div() + .id(id) + .role(Role::Group) + .aria_label(self.title.clone()) + .when_some(self.description.clone(), |row, text| { + row.aria_description(text) + }) .flex() .flex_wrap() .items_center()