tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Anna Vyalkova <cyber@sysrq.in>
Cc: tech@mandoc.bsd.lv
Subject: Re: [PATCH] cgi.c: label query and manpath
Date: Wed, 6 Jul 2022 19:40:06 +0200	[thread overview]
Message-ID: <YsXI9gTSl79hczPb@asta-kit.de> (raw)
In-Reply-To: <20220706155209.2475-1-cyber@sysrq.in>

Hi Anna,

Anna Vyalkova wrote on Wed, Jul 06, 2022 at 08:52:09PM +0500:

> Is visible label OK? Or should it be hidden?

https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/#naming_rule_visible_text

is quite clear:  using visible text is usually better:

  "In most circumstances, visible text labels also make the user
   interface easier to understand for all users."

I think this does apply to the search query input box.  Even some
users *looking* at the form might feel unsure what to enter there.

That does not appear to apply to the dropdrowns though because users
looking at the form will readily understand from the visible default
values what the purpose of the dropdowns is, whereas users of screen
readers will profit from the ARIA labels.

I committed the patch below.  Where that is easily possible, i prefer
expressing structure through nesting of elements rather than by using
attributes.  In this case, it is also shorter: same number of elements
and two fewer attributes.

This is now installed on man.bsd.lv for testing, too.

Yours,
  Ingo


Log Message:
-----------
For accessibility, label the last two widgets in the search form.
Patch from Anna Vyalkova <cyber at sysrq dot in>, significantly tweaked by me.

Modified Files:
--------------
    mandoc:
        cgi.c

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/cgi.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -Lcgi.c -Lcgi.c -u -p -r1.179 -r1.180
--- cgi.c
+++ cgi.c
@@ -444,13 +444,14 @@ resp_searchform(const struct req *req, e
 
 	/* Write query input box. */
 
-	printf("    <input type=\"search\" name=\"query\" value=\"");
+	printf("    <label>Search query:\n"
+	       "      <input type=\"search\" name=\"query\" value=\"");
 	if (req->q.query != NULL)
 		html_print(req->q.query);
-	printf( "\" size=\"40\"");
+	printf("\" size=\"40\"");
 	if (focus == FOCUS_QUERY)
 		printf(" autofocus");
-	puts(">");
+	puts(">\n    </label>");
 
 	/* Write submission buttons. */
 
@@ -491,7 +492,8 @@ resp_searchform(const struct req *req, e
 	/* Write manpath selector. */
 
 	if (req->psz > 1) {
-		puts("    <select name=\"manpath\">");
+		puts("    <select name=\"manpath\""
+		     " aria-label=\"Manual path\">");
 		for (i = 0; i < (int)req->psz; i++) {
 			printf("      <option");
 			if (strcmp(req->q.manpath, req->p[i]) == 0)
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


      reply	other threads:[~2022-07-06 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 15:52 Anna Vyalkova
2022-07-06 17:40 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YsXI9gTSl79hczPb@asta-kit.de \
    --to=schwarze@usta.de \
    --cc=cyber@sysrq.in \
    --cc=tech@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).