fix: composer hero reads project name to screen readers (#12397)
This commit is contained in:
1 parent
2d8f9a8f55
commit
45e06f48a0
2 files changed
+20
-6
No files matched your search
@@ -1455,7 +1455,7 @@ export function NewTaskDraftScreen(props: {
|
||||
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">in </Text>
|
||||
<Pressable
|
||||
accessibilityHint="Opens the project picker"
|
||||
accessibilityLabel={`Change project from ${selectedProject.title}`}
|
||||
accessibilityLabel={selectedProject.title}
|
||||
accessibilityRole="button"
|
||||
disabled={isComposerInteractionLocked}
|
||||
onPress={chooseProject}
|
||||
|
||||
@@ -136,10 +136,11 @@ export function DraftHeroHeadline({
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<MenuTrigger
|
||||
aria-label={hasResolvedProject ? "Change project" : "Choose a project"}
|
||||
className="pointer-events-auto inline-block max-w-64 truncate border-foreground/60 border-b border-dotted align-baseline text-foreground transition-colors hover:border-foreground/80 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
|
||||
/>
|
||||
// The trigger's accessible name comes from its visible text (the
|
||||
// project title) so the hero sentence reads naturally: an
|
||||
// aria-label here would replace the title with an action phrase
|
||||
// mid-sentence and baffle screen-reader users.
|
||||
<MenuTrigger className="pointer-events-auto inline-block max-w-64 truncate border-foreground/60 border-b border-dotted align-baseline text-foreground transition-colors hover:border-foreground/80 focus-visible:rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" />
|
||||
}
|
||||
>
|
||||
{activeProjectDisplayName ?? "Choose a project"}
|
||||
@@ -233,8 +234,21 @@ export function DraftHeroHeadline({
|
||||
</button>
|
||||
);
|
||||
|
||||
// The composer hero is a sentence, so the heading's accessible name must be
|
||||
// a complete sentence too. The project picker is a control rendered inline
|
||||
// in the h1; without an explicit label its widget state bleeds into the
|
||||
// announced phrase.
|
||||
const headingLabel = hasResolvedProject
|
||||
? `What should we build in ${activeProjectDisplayName}?`
|
||||
: canChooseProject
|
||||
? `${activeProjectDisplayName ?? "Choose a project"} to start`
|
||||
: "Add a project to start";
|
||||
|
||||
return (
|
||||
<h1 className="mx-auto w-full max-w-5xl text-center font-normal text-2xl text-foreground tracking-tight sm:text-3xl">
|
||||
<h1
|
||||
aria-label={headingLabel}
|
||||
className="mx-auto w-full max-w-5xl text-center font-normal text-2xl text-foreground tracking-tight sm:text-3xl"
|
||||
>
|
||||
{hasResolvedProject ? (
|
||||
<>What should we build in {projectSelector}?</>
|
||||
) : canChooseProject ? (
|
||||
|
||||
Reference in new issue
Block a user