From a8878515e0b5f26d390690a29349777a2e736640 Mon Sep 17 00:00:00 2001 From: Ronaldo Richieri Date: Wed, 18 Dec 2024 18:04:17 -0300 Subject: [PATCH] Add missing link from label to inputs on ticket create page To improve the accessibility of the ticket creation page so it can be better used by screen readers, add missing labels and input fields relationships across multiple elements used in the ticket creation page. --- share/html/Elements/AddLinks | 24 ++++++++++----------- share/html/Elements/EditCustomField | 4 +++- share/html/Elements/SelectOwnerAutocomplete | 2 +- share/html/Elements/SelectOwnerDropdown | 2 +- share/html/Elements/SelectSLA | 2 +- share/html/Elements/ShowRelationLabel | 7 ++++++ share/html/Ticket/Widgets/Create/Basics | 6 ++++++ share/html/Ticket/Widgets/Create/Dates | 4 ++-- share/html/Ticket/Widgets/Create/Message | 9 +++++--- share/html/Ticket/Widgets/Create/Times | 1 + 10 files changed, 40 insertions(+), 21 deletions(-) diff --git a/share/html/Elements/AddLinks b/share/html/Elements/AddLinks index d140ce2a13a..485b3369c96 100644 --- a/share/html/Elements/AddLinks +++ b/share/html/Elements/AddLinks @@ -119,25 +119,25 @@ foreach my $exclude_type ( keys %exclude_links ) {
-<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depends on'), Relation => 'DependsOn'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Depend} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depends on'), LabelFor => $id."-DependsOn", Relation => 'DependsOn'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Depend} |n%>/> -<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depended on by'), Relation => 'DependedOnBy'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Depend} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Depended on by'), LabelFor => "DependsOn-".$id, Relation => 'DependedOnBy'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Depend} |n%>/> -<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Parents'), Relation => 'Parents'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Member} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Parents'), LabelFor => $id."-MemberOf", Relation => 'Parents'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Member} |n%>/> -<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Children'), Relation => 'Children'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Member} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Children'), LabelFor => "MemberOf-".$id, Relation => 'Children'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Member} |n%>/> -<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Refers to'), Relation => 'RefersTo'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Refers to'), LabelFor => $id."-RefersTo", Relation => 'RefersTo'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/> -<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Referred to by'), Relation => 'ReferredToBy'), ReadOnly => 0 &> - " <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/> +<&| /Elements/LabeledValue, RawLabel => $m->scomp('ShowRelationLabel', Object => $Object, Label => loc('Referred to by'), LabelFor => "RefersTo-".$id, Relation => 'ReferredToBy'), ReadOnly => 0 &> + " <% $autocomplete |n %> <% $exclude_links{Refer} |n%>/>
diff --git a/share/html/Elements/EditCustomField b/share/html/Elements/EditCustomField index 38eec673c07..fe1681f736f 100644 --- a/share/html/Elements/EditCustomField +++ b/share/html/Elements/EditCustomField @@ -46,7 +46,9 @@ %# %# END BPS TAGGED BLOCK }}} -<&| /Elements/LabeledValue, Label => ( $Label ? $Label : $CustomField->Name ), LabelTooltip => $CustomField->EntryHint, FormText => $FormText &> +<&| /Elements/LabeledValue, Label => ( $Label ? $Label : $CustomField->Name ), + LabelFor => $Name, + LabelTooltip => $CustomField->EntryHint, FormText => $FormText &> <%perl> $m->comp( diff --git a/share/html/Elements/SelectOwnerAutocomplete b/share/html/Elements/SelectOwnerAutocomplete index 2b7f7598041..c6d8dd0142d 100644 --- a/share/html/Elements/SelectOwnerAutocomplete +++ b/share/html/Elements/SelectOwnerAutocomplete @@ -69,4 +69,4 @@ if ( $Default ) { my $limit = join '|', map { join '-', ref($_), ($_->id || '') } @$Objects; - + diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown index 4cbd04d7a96..66723dbd674 100644 --- a/share/html/Elements/SelectOwnerDropdown +++ b/share/html/Elements/SelectOwnerDropdown @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -> %if ($DefaultValue) { %} diff --git a/share/html/Elements/SelectSLA b/share/html/Elements/SelectSLA index 56cab38d9f9..5403bac1a6d 100644 --- a/share/html/Elements/SelectSLA +++ b/share/html/Elements/SelectSLA @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - % if ($DefaultValue) { % } diff --git a/share/html/Elements/ShowRelationLabel b/share/html/Elements/ShowRelationLabel index 32e46f4cc95..0e80240a076 100644 --- a/share/html/Elements/ShowRelationLabel +++ b/share/html/Elements/ShowRelationLabel @@ -45,11 +45,17 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} + <%INIT> my $typemap = $RT::Link::TYPEMAP{$Relation}; my $search_mode = $typemap->{Mode}; @@ -77,4 +83,5 @@ $m->callback( $Object => undef $Label $Relation +$LabelFor => undef diff --git a/share/html/Ticket/Widgets/Create/Basics b/share/html/Ticket/Widgets/Create/Basics index f5b6e9823a9..df02629a86c 100644 --- a/share/html/Ticket/Widgets/Create/Basics +++ b/share/html/Ticket/Widgets/Create/Basics @@ -56,6 +56,7 @@ { name => 'Queue', comp => '/Elements/SelectQueue', + labelfor => 'SelectRT::Queue', args => { Name => 'Queue', Default => $Queue->Id, @@ -67,6 +68,7 @@ { name => 'Status', comp => '/Ticket/Elements/SelectStatus', + labelfor => "SelectStatus", args => { Name => "Status", QueueObj => $Queue, @@ -75,6 +77,7 @@ { name => 'Owner', comp => '/Elements/SelectOwner', + labelfor => 'Owner', args => { Name => "Owner", Default => $ARGS{Owner} || RT->Nobody->Id, @@ -88,6 +91,7 @@ { name => 'Priority', comp => '/Elements/SelectPriority', + labelfor => 'SelectInitialPriority', args => { Name => "InitialPriority", Default => $ARGS{InitialPriority} ? $ARGS{InitialPriority} : $Queue->DefaultValue('InitialPriority'), @@ -97,6 +101,7 @@ { name => 'FinalPriority', comp => '/Elements/SelectPriority', + labelfor => 'SelectFinalPriority', args => { Name => "FinalPriority", Default => $ARGS{FinalPriority} ? $ARGS{FinalPriority} : $Queue->DefaultValue('FinalPriority'), @@ -109,6 +114,7 @@ { name => 'SLA', comp => '/Elements/SelectSLA', + labelfor => 'SLA', args => { Name => "SLA", Default => $ARGS{SLA} || RT::SLA->GetDefaultServiceLevel( Queue => $Queue ), diff --git a/share/html/Ticket/Widgets/Create/Dates b/share/html/Ticket/Widgets/Create/Dates index 58e83aabb50..cf471b69bad 100644 --- a/share/html/Ticket/Widgets/Create/Dates +++ b/share/html/Ticket/Widgets/Create/Dates @@ -50,12 +50,12 @@ <&| /Widgets/TitleBox, title => loc('Dates'), class=> 'ticket-info-dates' &>
- <&| /Elements/LabeledValue, Label => loc('Starts') &> + <&| /Elements/LabeledValue, Label => loc('Starts'), LabelFor => 'Starts' &> <& /Elements/SelectDate, Name => "Starts", Default => $ARGS{Starts} || $Queue->DefaultValue('Starts') || '' &>
- <&| /Elements/LabeledValue, Label => loc('Due') &> + <&| /Elements/LabeledValue, Label => loc('Due'), LabelFor => 'Due' &> <& /Elements/SelectDate, Name => "Due", Default => $ARGS{Due} || $Queue->DefaultValue('Due') || '' &>
diff --git a/share/html/Ticket/Widgets/Create/Message b/share/html/Ticket/Widgets/Create/Message index dc19af3e7d0..3f29255423b 100644 --- a/share/html/Ticket/Widgets/Create/Message +++ b/share/html/Ticket/Widgets/Create/Message @@ -50,7 +50,7 @@ <&| /Widgets/TitleBox, title => loc("Create a new ticket in [_1]", $m->scomp("/Ticket/Elements/ShowQueue", QueueObj => $Queue, Escape => 0)), class => 'messagedetails' &> % $m->callback(CallbackName => 'BeforeRequestors', QueueObj => $Queue, ARGSRef => \%ARGS); -<&| /Elements/LabeledValue, Label => loc("Requestors") &> +<&| /Elements/LabeledValue, Label => loc("Requestors"), LabelFor => 'Requestors' &> <& /Elements/EmailInput, Name => 'Requestors', Default => $ARGS{Requestors} // $session{CurrentUser}->EmailAddress, @@ -61,6 +61,7 @@ <&| /Elements/LabeledValue, Label => loc("Cc"), + LabelFor => 'Cc', LabelTooltip => loc('Sends a copy of this update to the provided users or groups. These people will receive future updates.'), &> <& /Elements/EmailInput, @@ -72,6 +73,7 @@ <&| /Elements/LabeledValue, Label => loc("Admin Cc"), + LabelFor => 'AdminCc', LabelTooltip => loc('Sends a copy of this update to the provided users or groups. These people will receive future updates.'), &> <& /Elements/EmailInput, @@ -91,6 +93,7 @@ % while (my $role = $roles->Next) { <&| /Elements/LabeledValue, Label => $role->Name, + LabelFor => $role->GroupType, LabelTooltip => $role->EntryHint, &> <& /Elements/MultiUserRoleInput, role => $role, Default => $ARGS{$role->GroupType} &> @@ -107,8 +110,8 @@ ForCreation => 1, &> - <&| /Elements/LabeledValue, Label => loc("Subject") &> - + <&| /Elements/LabeledValue, Label => loc("Subject"), LabelFor => 'Subject' &> + % $m->callback( %ARGS, CallbackName => 'AfterSubject' ); diff --git a/share/html/Ticket/Widgets/Create/Times b/share/html/Ticket/Widgets/Create/Times index df674ec64e5..9ca0ca2c9e7 100644 --- a/share/html/Ticket/Widgets/Create/Times +++ b/share/html/Ticket/Widgets/Create/Times @@ -68,6 +68,7 @@ my @fields = ( { name => 'TimeEstimated', comp => '/Elements/EditTimeValue', + labelfor => 'SetTimeEstimated', args => { Name => 'TimeEstimated', Default => $ARGS{TimeEstimated} || '',